On Tue, Aug 31, 2021 at 11:47 AM Steven D'Aprano <st...@pearwood.info> wrote: > > On Tue, Aug 31, 2021 at 02:23:29AM +1000, Chris Angelico wrote: > > On Tue, Aug 31, 2021 at 2:19 AM Christopher Barker <python...@gmail.com> > > wrote: > > > > 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. > > I'm not a big user of Enums, but I *think* that only applies for > IntEnums? > > In any case, in this case it wouldn't make sense to combine NAN > policies. What would it mean to combine the "raise exception on NAN" and > "ignore NANs" policies? >
Agreed. In this case, an enum offers little that a string can't do just as well. But there are plenty of other situations where an enum would be better (*ahem* open modes?), although they do come with a performance hit in some cases. ChrisA _______________________________________________ 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/OIUE3LLE7NY23IKAE7SSEET2LPXGNZGV/ Code of Conduct: http://python.org/psf/codeofconduct/