> On 2018 Mar 29 , at 12:06 p, Chris Angelico <ros...@gmail.com> wrote: > > On Fri, Mar 30, 2018 at 3:00 AM, Stephan Houben <stephan...@gmail.com> wrote: >> Perhaps one day we will be able to use >> >> â >> >> for the empty set. >> That would actually match conventional notation. >> > > Maybe, but that symbol generally means the unique immutable empty set > in mathematics, so a closer equivalent would be frozenset(), in the > same way that () gives you a singleton immutable empty tuple. But yes, > I would like to some day have a literal for an empty set. Just not > "{}". >
Mathematically, {1,2,3} is a unique, immutable set, too. {1,2,3} \union {4} doesn't modify {1,2,3}; it's just another way to represent another unique immutable set {1,2,3,4}. So I don't seen any problem (aside from the general resistance Unicode) with using â to mean set(). However, just as string literals take a variety of prefixes (r, u, b, f), why can't set/dict literals? d{} == {} == dict() d{"a": 2} == {"a": 2} == dict(a=2) s{1,2,3} == {1,2,3} == set([1,2,3]) s{} == set() f{} == frozenset() f{1,2,3} == frozenset({1,2,3}) (I vaguely recall hearing a proposal to use o{...} for ordered dicts, so maybe this has already been considered. The only information I can find on set literals, though, assume {...} as a foregone conclusion, with various wrapped symbols like {/}, {@}, and {:} suggested to complement {}.) If we did use â for an empty set, then fâ could be the empty frozen set. -- Clint _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/