Initializing a set from a list

Xiaolei Li propheci at gmail.com
Wed Jun 21 01:59:00 EDT 2006


Hi,

I'm trying to initialize a set from a list but am unable to do so.  My
list "c", looks like:

[(1.00909, 0.91969999999999996, -0.13550388182991072, 0),
(0.87423999999999991, 0.6666700000000001, -0.21230487137222254, 0)]

So basically a list of 2 tuples, each with 4 elements.  Since tuples
are immutable, I think a set should be able to support them.

Anyway, I then do:

set_c = set(c)

And instead of getting a set, I get "None" when I try to print out
set_c.  len(set_c) complains "TypeError: len() of unsized object."
Help?  

Thank you.




More information about the Python-list mailing list