[Python-3000] sets in P3K?

Greg Wilson gvwilson at cs.utoronto.ca
Tue Apr 25 03:35:21 CEST 2006


> Ian Bicking:
> Instead you get set([2, 3, 5, 7]), which is much less attractive and
> introduces an unneeded intermediate data structure.  Or set((2, 3, 5,
> 7))... which is typographically prettier, but probably more confusing to
> a newbie.
>
> Generator comprehensions + dict() were a nice alternative to dict
> comprehension, and also replace the need for set comprehension.  I feel
> like there might be some clever way to constructing sets?  Not that
> there's any direct relation to generator expressions that I can see, but
> maybe something in the same vein.

One of the reasons I'd like native syntax for sets is that I'd like set
comprehensions:

    a = {b for b in c where b > 0}

may not quite be as beautiful as using epsilon for membership (sorry, Alex
;-), but it's still quite nice.

Greg


More information about the Python-3000 mailing list