[Python-3000] Set literal

Thomas Wouters thomas at python.org
Thu Jan 31 00:40:42 CET 2008


On Jan 30, 2008 3:17 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

> Nicko van Someren wrote:
> > Personally I'd like set comprehensions to give me mutable
> > sets, and so I feel set literals should do the same.
>
> Do you really want set comprehensions at all, given that
> set(genexp) exists?
>

Too late.

>>> {i for i in range(5) }
{0, 1, 2, 3, 4}
>>> {i: "foo" for i in range(5) }
{0: 'foo', 1: 'foo', 2: 'foo', 3: 'foo', 4: 'foo'}

Welcome-to-py3k-ly y'rs,

-- 
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20080130/d9d37e6b/attachment.htm 


More information about the Python-3000 mailing list