len() should always return something

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Fri Jul 24 14:59:40 EDT 2009


On Fri, 24 Jul 2009 16:50:03 +0200, superpollo wrote:

>> Nah.  7 contains three bits, so len(7) should *clearly* return 3.
> 
> and len("7") must return 8, by the same token... but wait!
> 
>  >>> len("7")
> 1
>  >>>
>  >>>
> my python installation must me outdated ;-)

No no no, you're obviously using an awesome version of Python that can 
compress single-character strings to a single bit!



-- 
Steven



More information about the Python-list mailing list