len() should always return something
Erik Max Francis
max at alcyone.com
Sun Jul 26 01:21:39 CEST 2009
Steven D'Aprano wrote:
> But it's not "practically every function". It's hardly any function at
> all -- in my code, I don't think I've ever wanted this behavior. I would
> consider it an error for function(42) and function() to behave the
> same way. One is a scalar, and the other is a vector -- they're different
> things, it's poor programming practice to treat them identically.
> (If Matlab does this, so much the worse for Matlab, in my opinion.)
There's actually good reason to do this in heavily matrix-oriented
specialized languages; there are numerous applications where scalars and
1x1 matrices are mathematically equivalent.
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis
Gods are born and die, but the atom endures.
-- Alexander Chase
More information about the Python-list