ways to declare empty set variable

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Feb 12 16:29:35 EST 2008


En Tue, 12 Feb 2008 12:04:43 -0200, Sun <as at hut.at> escribió:
> "Chris" <cwitts at gmail.com> wrote

>>>>> test = set()
>>>>> test
>> set([])
>
> yeah, that 's what I am looking for, thanks all for such prompt answers!
>
> I was wondering why can't I use a format as "var = {} " to "var=list()"  
> in
> set variable, and decided not to  bother with it.

Python 3.0 has set literals {1,2,3} (perhaps they become frozensets  
instead). But {} still is, and will be, an empty dict.
In reply to the n-th proposal to define a literal for empty sets, Guido  
van Rossum said, in python-ideas:

	"All possible proposals have already been discussed at length. Really,  
writing set() isn't so bad. Get used to it."

http://mail.python.org/pipermail/python-ideas/2008-January/001316.html

-- 
Gabriel Genellina




More information about the Python-list mailing list