len() should always return something

Diez B. Roggisch deets at nospam.web.de
Fri Jul 24 10:51:12 EDT 2009


Mark Dickinson schrieb:
> On Jul 24, 3:11 pm, "Rhodri James" <rho... at wildebst.demon.co.uk>
> wrote:
>> Which doesn't make your point less valid.  In fact I'd go so
>> far as to argue that what len() gives you is the number of
>> items in a container, so len(7) should return 0.
> 
> Nah.  7 contains three bits, so len(7) should *clearly* return 3.

But it contains a minimum of 32 bits! And why are you treating ones as 
special over zeros? I thought the times of BitRacism were finally over...

Diez



More information about the Python-list mailing list