Le mercredi 26 avril 2006 à 08:40 -0400, Greg Wilson a écrit :
> I think this is because:
> 
> a) sets are new to Python --- habit and examples both encourage us to use
>    lists, even when the collections in question aren't intrinsically
>    ordered; and
> 
> b) the current notation is unpleasant --- I appreciate Raymond et al's
>    dislike of egregious punctuation (it's why we all abandoned Perl,
>    right?), but {1, 2, 3} *is* a lot cleaner than set([1, 2, 3]).

I think Raymond H is right:
1) sets are most often built dynamically rather than statically (in my
own experience)
2) set([1,2,3]) makes little sense anyway, since it probably isn't
significantly more efficient than [1,2,3]

The real benefit of sets is when you have at least tens or hundreds of
elements; in that case you won't use a literal to build the set.

Another remark is that I often use sets to hold my own objects rather
than simple values (ints or strings). In a sense, I use sets as iterable
containers where arbitrary remove() is fast.



_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to