[Python-ideas] syntax for set
Alexandre Conrad
alexandre.conrad at gmail.com
Mon Nov 15 04:15:03 CET 2010
Hi,
I am sure this has come up before and if it doesn't exist I believe
there is a good reason for it. Anyway, here's my thought: how about
having a syntax representation for sets? A mix of a dict and
list/tuple syntax would make the most sense, such as:
>>> isinstance({"foo", "bar"}, set)
True
The problem here is: how to represent an empty set as {} would
conflict with the dict repr. Then how about using a brand new
"container" syntax that wouldn't conflict with existing ones?
>>> <"foo", "bar"> == set(("foo", "bar"))
True
>>> <> == set()
True
--
Alex | twitter.com/alexconrad
More information about the Python-ideas
mailing list