On 2/6/06, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> On 2/6/06, Donovan Baarda <[EMAIL PROTECTED]> wrote:
> > yeah... the problem is differentiating the empty set from an empty dict.
> > The only alternative that occured to me was the not-so-nice and
> > not-backwards-compatible "{:}" for an empty dict and "{}" for an empty
> > set.
>
> How about spelling the empty set as ``set()''? Wouldn't that solve the
> ambiguity and the backwards compatibility nicely?

And of course, thanks to the time machine, it has always worked that way:

hesperos:~$ python2.4
Python 2.4.1 (#1, Apr 21 2005, 11:14:17)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> set()
set([])
>>>

just like dict(), tuple(), list(), str(), int(), float(), bool(),
complex() -- each type, called without args, returns an instance F of
that type such that "bool(F) is False" holds (meaning len(F)==0 for
container types, F==0 for number types).


Alex
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to