On 2021-08-30 09:23, Chris Angelico wrote:
On Tue, Aug 31, 2021 at 2:19 AM Christopher Barker <python...@gmail.com> wrote:
To be honest, I haven't really used Enums much (in fact, only to mirror C enums 
in extension code), but part of that is because I have yet to see what the 
point is in Python, over simple string flags.

I suppose they provide a real advantage for static typing, but other than that 
I just don't see it.

They provide a *huge* advantage when they can be combined. It's easy
to accept a flags argument that is the bitwise Or of a collection of
flags, and then ascertain whether or not a specific flag was included.
The repr of such a combination is useful and readable, too.

In general I find that harder to grok than just using separate boolean arguments for each flag.

--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail."
   --author unknown
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@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/IUIXFAS47Z7Y7UAILD3UKUNDSVO7WKKC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to