Enums: making a single enum
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sat May 26 11:40:19 EDT 2018
On Sat, 26 May 2018 23:54:51 +1000, Chris Angelico wrote:
> Seems pretty non-controversial, which means it's almost guaranteed to
> reach 100+ posts debating what the name should be.
Including:
* 27 posts declaring that using such singleton symbols is completely
un-Pythonic and is sure to doom Python to irrelevancy;
* 13 posts stating that whether it is spelled "Symbol(name)" or
"Atom(name)" it will be completely confusing;
* 4 posts proposing spelling it "~~name!" instead;
* 25 posts agreeing that the functionality is important, but
should only be allowed inside functions whose name starts
with a vowel;
* 11 posts insisting it should only be functions starting
with a consonant;
* 3 posts saying it shouldn't be allowed in functions at all,
only in module-level try...except statements, and only so
long as there are no list comprehensions used in the module;
* 18 posts demanding a complete list of every use-case for the
feature and why using object()/strings/enums/ints isn't
sufficient;
* 7 posts stating that the author would personally use it if it
were a built-in, and they wouldn't bother installing a third-
party package from PyPI for it, but nevertheless it should be
put on PyPI first to see if there is any community interest;
* 12 posts cherry-picking programming languages invented between
August 2003 and May 2015 by people whose name starts with "B",
proving categorically that the modern trend is to avoid this
feature;
* and 17 posts discussing the history of Forth and Intercal.
Good thing I didn't propose a short-hand syntax for it as well :-)
--
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson
More information about the Python-list
mailing list