After reading some discussion on the Python main list about the enum
module and some suggested changes, I thought I would read the docs on
it at
https://docs.python.org/3/library/enum.html?highlight=enum#module-enum

Most of the mechanics of using it, Enum in particular, seem
understandable to me, but I am having difficulty imagining where I
might want to use these features.

I did some searching and read the first few results, mostly from Stack
Overflow.  So far only a couple of situations occur to me:

1)  Seems I could have a Constants class, like:

class Constants(Enum):
    PI = 3.1415
    E = 2.718
    etc.

2)  Or if I had a GUI, I could give names to things like radio
buttons, checklist boxes, etc., though I don't see why I would not
just use the normal indices (Which start from the usual zero, unlike
how the examples seem to be written in the enum docs.).

And I am having an even harder time imagining what I would want to use
Enum for if I don't care about the values assigned to the names and
use auto to automatically assign values.  I am having a real crisis of
imagination here!  Anyone with some commonplace and practical
applications of the enum module?

TIA!

-- 
boB
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to