Coding style

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Jul 19 06:44:28 EDT 2006


In <44be0387_3 at news.bluewin.ch>, Boris Borcic wrote:

> Bruno Desthuilliers wrote:
>> 
>> empty_list = []
>> bool(empty_list) is False
>> => True
> 
> it's just a pity that the symmetric expression
> 
> list(False) is []
> 
> doesn't hold.

You want the empty list to be a singleton!?  And I don't find
`list(False)` to return an empty list be very obvious.

> I guess the problem is that if list(False) was thus defined, it would be 
> difficult not to define list(True). And then the zen of Python clashes
> 
> "In the presence of ambiguity, refuse the temptation to guess".
> 
> OTOH, my favorite there would be
> 
> list(True) is [None]

Wow it even gets better, the list containing one `None` object should be a
singleton too.  Argh.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list