builtin set literal

Schüle Daniel uval at rz.uni-karlsruhe.de
Thu Feb 15 11:12:33 EST 2007


[...]

>>> In Python 3.0, this looks like::
>>>
>>>     s = {1,2,3}
>>
>> jepp, that looks not bad .. as in a mathe book.
>> the only disadvantage I see, that one may confuse it with a dict.
> 
> Perhaps with a very cursory inspection. But the lack of any ':' 
> characters is a pretty quick clue-in.

there is one a bigger disadvantage though
{} empty set clashes with empty dict {}
set() still must be used to generate the empty set
or a hack like
s = {None}.clear()

I think something like {-} as the substitution for empty set
will seem bit to perlish for most of us? :)

Regards, Daniel



More information about the Python-list mailing list