len() should always return something

Grant Edwards invalid at invalid
Mon Jul 27 21:27:47 CEST 2009


On 2009-07-27, Joshua Kugler <joshua at joshuakugler.com> wrote:
> Dr. Phillip M. Feldman wrote:
>
>> "As far as I know, there is no programming language which
>> treats scalars like ints as if they were vectors of length 1"
>> 
>> Actually, Matlab does:
>> 
>>>> length(5)
>> ans =
>>      1
>>>> 
>
> Oddly enough, so does Perl:
>
> $ print length(44)
> 2

No, that's not really treating scalars as vectors of length 1.
Were it doing so, length(44) would be 1 rather than 2.  What
Perl does is treat everything as a string.

-- 
Grant Edwards                   grante             Yow! I was making donuts
                                  at               and now I'm on a bus!
                               visi.com            



More information about the Python-list mailing list