len() should always return something

Chris Rebert clp2 at rebertia.com
Sat Jul 25 22:39:13 EDT 2009


On Sat, Jul 25, 2009 at 6:47 PM, Erik Max Francis<max at alcyone.com> wrote:
> Chris Rebert wrote:
>>
>> On Sat, Jul 25, 2009 at 4:21 PM, Erik Max Francis<max at alcyone.com> wrote:
>>>
>>> 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([42]) 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.
>>
>> The pertinent issue here being that Python, as a language, is neither
>> matrix-oriented nor special-purpose. :)
>
> Yes.  And I was responding to the comment that such a feature of a language
> would a priori be poor design.  It _isn't_ poor design for special purpose
> languages.  Python isn't one of them, but Matlab _is_.

I was agreeing with your point actually. That was what I was trying to
convey in my post. Apparently I wasn't as successful in that regard as
I'd hoped.

- Chris
-- 
http://blog.rebertia.com



More information about the Python-list mailing list