
I just do this myself in my text editor (vim): [image: sets-py.png] But this is just cosmetic because I like to look at it this way. The actual file on disk contains `set()`, `<=`, `in`, `not in` and wouldn't be a problem for anyone without the same fonts installed, or require anyone to know odd key combos. On Thu, Mar 17, 2022 at 8:35 AM Michael Smith <michael@smith-li.com> wrote:
Hmm, I think the idea of the mathematical symbol is interesting, but I think users are more interested in constructing a new, eventually-not-empty set, than referencing the empty set.
Semantically, I don't know if ∅() is satisfying.
On Thu, Mar 17, 2022 at 08:19 Stéfane Fermigier <sf@fermigier.com> wrote:
The “correct” (according to Bourbaki) mathematical notation for an empty set is “∅" (aka Unicode U+2205, or HTML ∅)
Some time ago, for a project which had a lot of empty sets, I tried to use this symbol as a short hand for set(). But:
⦰ = set() File "<stdin>", line 1 ⦰ = set() ^ SyntaxError: invalid character '⦰' (U+29B0) ø = set()
In other words, “⦰” is illegal as an identifier in Python (same for ⌀ aka U+2300 DIAMETER SIGN), but “ø” (aka U+00F8 LATIN SMALL LETTER O WITH STROKE) is legal !
So I used "⌀" instead of “⦰”, but I eventually dropped the whole idea because, IIRC, some tools weren’t too happy with it.
Still, I guess it wouldn’t be neither too hard nor two disruptive to accept “⦰” as well as some other mathematical characters as identifiers in Python.
Since once of the application domains where Python shines nowadays is mathematics (numerical, but also symbolic), I think it’s a shame that we are preventing to use the proper unicode characters to designate some universal mathematical objects.
More info here: https://en.wikipedia.org/wiki/Null_sign
S.
On 13 Mar 2022 at 22:52:16, joao.p.f.batista.97@gmail.com wrote:
Currently: l = [] # new empty list t = () # new empty tuple s = set() # new empty set (no clean and consistent way of initializing regarding the others) <<< d = {} # new empty dictionary
Possible solution: s = {} # new empty set d = {:} # new empty dictionary (the ":" is a reference to key-value pairs)
Current workaround at least for consistency: l = list() # new empty list t = tuple() # new empty tuple s = set() # new empty set d = dict() # new empty dictionary
However, it doesn't feel right to not be able to initialize an empty set as cleanly and consistently as lists, tuples and dictionaries in both forms. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/OPWEKL... Code of Conduct: http://python.org/psf/codeofconduct/
-- Stefane Fermigier - http://fermigier.com/ - http://twitter.com/sfermigier - http://linkedin.com/in/sfermigier Founder & CEO, Abilian - Enterprise Social Software - http://www.abilian.com/ Co-Founder & Co-Chairman, National Council for Free & Open Source Software (CNLL) - http://cnll.fr/ Co-Founder & Chairman, Association Professionnelle Européenne du Logiciel Libre (APELL) - https://www.apell.info/ Co-Founder & Spokesperson, European Cloud Industrial Alliance (EUCLIDIA) - https://www.euclidia.eu/ Founder, PyParis & PyData Paris - http://pyparis.org/ & http://pydata.fr/ _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/D3SSAH... Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/Z43FW7... Code of Conduct: http://python.org/psf/codeofconduct/
-- Keeping medicines from the bloodstreams of the sick; food from the bellies of the hungry; books from the hands of the uneducated; technology from the underdeveloped; and putting advocates of freedom in prisons. Intellectual property is to the 21st century what the slave trade was to the 16th.