[Numpy-discussion] Response to PEP suggestions

Robert Kern rkern at ucsd.edu
Fri Feb 18 07:24:22 CST 2005

Paul Barrett wrote:

> How about proposing a PEP to extend Python's scalar behavior, so the 
> len(a) works for either scalars or arrays.  Though I haven't thought 
> this through in great detail, it would appear to be a transparent 
> addition for most Python users who would never use this.  At the same 
> time, we should also consider other behavior that would unify (or smear) 
> the behavior of Python scalars and arrays.

I'm sure there are any number of people who use len(x) as a way to test 
the sequenceness of x. While it might be okay for rank-0 arrays, 
extending this to builtin ints and floats may not be a good idea. I'm 
pretty sure this would get rejected.

Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

More information about the Numpy-discussion mailing list