RE: [Numpy-discussion] rank-0 arrays
by Travis Oliphant other posts by this author
Sep 13 2002 10:51PM messages near this date
RE: [Numpy-discussion] rank-0 arrays
|
Re: [Numpy-discussion] rank-0 arrays
> Hi Travis,
>
> refresh my memory about how this proposal would work. I've heard
> proposals to add new types to Python itself, but that seems out of
> the question. Are you talking about adding new scalar types as
> module? E.g.
>
> >>> x = Int8(22)
> >>> arr = arange(10, typecode = Int8)
> >>> arr[2]
> Int8(2)
>
> Or some other approach?
This is the gist of it. Basically you extend the Python scalars to
include the single precision types (all the types Numeric supports).
Ultimately, in Python it would be nice if all of the scalars had the same
base class.
>
> In any case, doesn't this still have the problem that Eric complained
> about, having to test for whether a result is an array or a scalar
> (which was one of the drivers to produce rank-0 results).
I would have to understand his reason better. He could be right. My
reason for rank-0 results as always been more of a type issue. I'll have
to ask him.
Now I remmber an issue that makes me question the proposal:
Currently the length of a rank-0 array is 1, while the length of a scalar
raises an error --- this is a bad difference.
We could still implement rank-0 arrays as a separate (optimized) type
though (so it doesn't carry around the extra baggage of full-rank arrays).
Now-wanting-rank-0-arrays-all-the-time,
-Travis
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@[...].net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Thread:
Perry Greenfield
Travis Oliphant
Pearu Peterson
Konrad Hinsen
Perry Greenfield
Todd Miller
Pearu Peterson
Konrad Hinsen
Travis Oliphant
Konrad Hinsen
Perry Greenfield
Travis Oliphant
Tim Hochberg
Chris Barker
Konrad Hinsen
Perry Greenfield
Travis Oliphant
Pearu Peterson
Tim Hochberg
Perry Greenfield
Konrad Hinsen
Perry Greenfield
eric jones
Konrad Hinsen
eric jones
Konrad Hinsen
Tim Hochberg
Tim Hochberg
Paul F Dubois
Scott Gilbert
Konrad Hinsen
|