ways to declare empty set variable

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Tue Feb 12 23:47:15 CET 2008

Paul Rubin:
> In 3.0 you may be able to say {,} but there is a contingent that would
> just as soon get rid of all that special syntax, so you'd say list()
> instead of [], dict() instead of {}, etc.

For Python 3.0 I'd like {} for the empty set and {:} for the empty
dict, but that idea was refused time ago, probably for some mental
backward compatibility. Missing that, I think dict() and set() and
tuple() and list() look better than using {} for the empty dict and
{/} for the empty set and () for empty tuple (or {} for the empty dict
and set() for the empty set).
dict() is a bit more verbose than {}, but it doesn't matter much. With
those dict(), set(), tuple(), list() the only little wart left is the
unary tuple literal: x,  that I don't like much, maybe I'd like tuple
to be identified by a pair of delimiters, maybe like [|x|] or
something like that as in the Fortress language. I don't know...


More information about the Python-list mailing list