[Numpy-discussion] Response to PEP suggestions
barrett at stsci.edu
Fri Feb 18 11:52:20 CST 2005
Robert Kern wrote:
> Timo Korvola wrote:
>> Robert Kern <rkern at ucsd.edu> writes:
>>> I'm not averse to len(x) returning 0 when given a rank-0 array. I see
>>> it as giving up one consistency (that scalar-like objects don't have
>>> lengths) for another (arrays having a common set of operations that
>>> one can expect regardless of rank or shape).
>> That would be akin to making 0/0 return 0. It is possible to create
>> arrays of length zero, e.g, by indexing with an empty slice, and these
>> should not be confused with rank zero arrays.
> Fair enough. I'm not averse to len(x) raising an exception when x is a
> rank-0 array either. :-)
Or it could return 'None', i.e. undefined.
Paul Barrett, PhD Space Telescope Science Institute
Phone: 410-338-4475 ESS/Science Software Branch
FAX: 410-338-4767 Baltimore, MD 21218
More information about the Numpy-discussion