On 5/2/06, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> I think Guido had the best solution. Use set() for empty sets, use {}
> for empty dicts, use {genexp} for set comprehensions/displays, use
> {1,2,3} for explicit set literals, and use {k1:v1, k2:v2} for dict
> literals. We can always add {/} later if demand exceeds distaste.
I understand {1,2,3} vs {k1:v1, k2:v2}, but what is the {genexp} for?
As I read that, if the generator yielded two-tuples, you would get a
set of two-tuples rather than a dict. There would be no comprehension
syntax for dicts.
I'm not sure we need a comprehension syntax for dicts, but I'm not
sure we need one for sets either.
>>> set(gen())
doesn't seem any worse than
>>> dict(gen())
-jJ
_______________________________________________
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