Coding style

Boris Borcic bborcic at gmail.com
Wed Jul 19 06:03:23 EDT 2006


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.

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]

together with

list(n) == n*[None] for all positive integers n

Cheers, BB
--
666 ?? - 666 ~ .666 ~ 2/3 ~ 1-1/3 ~ tertium  non datur ~ the excluded middle
              ~ "either with us, or against us" !!



More information about the Python-list mailing list