Greg Wilson wrote:
>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}
>
>
>
>
This is no good. That form could as easily represent a frozenset
comprehension or dict comprehension. It buys us nothing over the clear
and unambiguous form we have now:
set(b for b in collection if b > 0)
Distinguishing between sets, frozensets, and dicts is an insurmountable
hurdle for punctuation based proposals (because you can't make the
distinctions without introducing complexity). Besides, there are no
real gains to be had -- adding punctuation seems to have become a quest
unto itself.
Embrace genexps -- they are a path to uniform and clear expression
across a wide range of datatypes.
Avoid punctuation and funky syntax -- they burden the learning curve,
they do not generalize well, they challenge parsers (both human and
electronic), and they throw-away the clarity affored by spelled-out
datatype names.
Raymond
_______________________________________________
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