[Python-ideas] Empty set, Empty dict

Nick Coghlan ncoghlan at gmail.com
Sun Jun 22 15:04:31 CEST 2014


On 22 June 2014 22:51, Chris Angelico <rosuav at gmail.com> wrote:
> At least the concept of "empty set literal" has more merit than "save
> a few keystrokes on the word 'lambda'". Even if it isn't something
> easily typed, it would have value over the current spelling of
> "set()", which isn't a literal. (Whether it has *enough* value over
> set() to be worth doing is still in question, but it's not like lambda
> vs λ.)

Yep, "status quo wins a stalemate" tends to be the winner on this
particular topic. With a blank slate, the obvious choice is {} for the
empty set and {:} for the empty dict, but Python doesn't have that
option due to builtin sets arriving *long* after builtin dicts (for a
very long time, sets weren't even in the standard library - folks just
used dicts with the values all set to None).

So, for those historical reasons, set() will likely persist
indefinitely with its discontinuity in appearance between the "zero
items" and "one or more predefined items" cases.

Cheers,
Nick,

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list