Why bool( object )?

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Wed Apr 29 09:39:38 EDT 2009


Lawrence D'Oliveiro a écrit :
> In message <54cb7f8a-
> fef4-4bf8-8054-16dc9b5c8830 at d2g2000pra.googlegroups.com>, Aaron Brady wrote:
> 
>> What is the rationale for considering all instances true of a user-
>> defined type?
> 
> It's a stupid idea, 

Nope, it's a very sensible default (given you can redefine the 
'nothingness' value of your types instances), specially when the 
language doesn't have a proper boolean type (which was the case for 
Python until 2.2 or 2.3, can't remember exactly).

> and there seem to be instances of users tripping over it 
> here in comp.lang.python every week.

Which is why some users opposed to the introduction of a boolean type in 
Python by the time. Please read Steven D'aprano's post upper in this 
thread, and follow the provided link. Laura Creighton was alas spot on: 
introducing a boolean type only resulted in confusion.






More information about the Python-list mailing list