ways to declare empty set variable

Sun as at hut.at
Tue Feb 12 09:04:43 EST 2008


"Chris" <cwitts at gmail.com> wrote in message 
news:f30e545f-4485-4c0a-a9b2-476939818bc6 at y5g2000hsf.googlegroups.com...
> On Feb 12, 3:45 pm, "Sun" <a... at hut.at> wrote:
>> Maybe this is a very primative question, but I just get a bit confused 
>> about
>> 'set' and 'Set' module in python.
>>
>> I understand 'set' is a build in type in python after 2.4(or 2.3) and Set 
>> a
>> seperate module, anyhow, I gonna use build in 'set'.
>>
>> then the question is how can I declare a empty set variable as a 'var= 
>> []'
>> do to a list variable?
>
>>>> test = set()
>>>> test
> set([])
>>>> type(test)
> <type 'set'>
>
> You looking for that ?

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.

Thanks.







More information about the Python-list mailing list