Re: [Numpy-discussion] Behavior of array scalars
by Travis Oliphant other posts by this author
Feb 17 2006 4:54PM messages near this date
Re: [Numpy-discussion] Behavior of array scalars
|
Re: [Numpy-discussion] Behavior of array scalars
Sasha wrote:
> It would be nice to collect the motivations behind the current state
> of affairs with rank-0 arrays in one place. Due to the "hard-hat"
> nature of the issue, I would suggest to do it at
> http://projects.scipy.org/scipy/numpy/wiki/ZeroRankArray .
>
> Travis' Numeric3 design document actually leaves the issue open
>
>
>
This document is old. Please don't refer to it too stringently. It
reflected my thinking at the start of the project. There are mailing
list discussions that have more relevance. The source reflects what
was actually done. What was done is introduce scalar array types for
every data-type and return those.
I had originally thought that the pure Python user would *never* see
rank-0 arrays. That's why PyArray_Return is called all over the place
in the code. The concept that practicality beats purity won out and
there are a few limited wasy you can get zero-dimensional arrays (i.e.
using array(5) which used to return an array scalar). They just don't
*stay* 0-d arrays and are converted to array scalars at almost every
opportunity.... I have been relaxing this over time, however.
I can't say I have some grand understanding that is guiding the
relaxation of this rule, however, except that I still think array
scalars are *better* to deal with (I think this will be especially
obvious when we get scalar math implemented). So, I relunctantly give
visibility to 0-d arrays when particular use-cases emerge.
> In any case I will collect all these thoughts on the ZeroRankArray
> page unless I hear that this belongs to the main wiki.
>
>
It's a good start. This particular use case of course is actually
showing us a deeper flaw in our use of output arguments in the ufunc
which needs changing.
-Travis
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@[...].net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Thread:
Christopher Barker
Travis Oliphant
Sasha
Travis Oliphant
Christopher Barker
Sasha
Travis Oliphant
David M. Cooke
Sasha
Travis Oliphant
Travis Oliphant
Sasha
Travis Oliphant
Sasha
Alexander Belopolsky
Sasha
|