On 4/24/06, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> Greg Wilson wrote:
>
> >I'm sure we can work something out --- I agree, {} for empty set and {:}
> >for empty dict would be ideal, were it not for backward compatibility.
> >
[snip]
> Further, punctuation approaches face uncomfortable choices with respect
> to iterables. Would {range(3)} be allowed? If not, then you've lost a
> key bit of functionality and imposed an arbitrary restriction. If so,
> then do you allow something similar for dicts? If not, then you've
> introduced another arbitrary inconsistency. If so, then you face more
> challenges distinguishing between sets and dicts -- is {somegen()} a set
> or dict -- there are valid interpretations either way if somegen()
> returns tuples.
While I agree with all your other arguments (and I'm perfectly happy
to write dict(), set() and list() when necessary), I think there's no
reason to be confused about something like ``{range(3)}``. It would
work exactly like list literals do:
>>> [range(3)]
[[0, 1, 2]]
This is not an "arbitrary restriction" -- unless you believe that
lists also have such an arbitrary restricion.
STeVe
--
Grammar am for people who can't think for myself.
--- Bucky Katt, Get Fuzzy
_______________________________________________
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