Re: [Tutor] What would be good use cases for the enum module?

2017-04-10 Thread Steven D'Aprano
On Sun, Apr 09, 2017 at 10:21:49AM -0500, boB Stepp wrote: > A general question about PEPs: Is there generally a PEP preceding the > addition of any new feature to the core language or the standard > library? I gather that even an accepted PEP (In this instance PEP > 0435.) may not reflect the f

Re: [Tutor] What would be good use cases for the enum module?

2017-04-09 Thread boB Stepp
On Sat, Apr 8, 2017 at 11:13 PM, Steven D'Aprano wrote: > On Sat, Apr 08, 2017 at 10:00:21PM -0500, boB Stepp wrote: >> 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/

Re: [Tutor] What would be good use cases for the enum module?

2017-04-09 Thread Alan Gauld via Tutor
On 09/04/17 13:58, Mats Wichmann wrote: > All of these can of course be done without enums. So the extra benefit > of an enum is that the set is closed (immutable) and requires > uniqueness: picking some other value will be an error, Indeed, good catch. The value of an enum over an integer is t

Re: [Tutor] What would be good use cases for the enum module?

2017-04-09 Thread Mats Wichmann
On 04/09/2017 01:54 AM, Alan Gauld via Tutor wrote: > On 09/04/17 04:00, boB Stepp wrote: > >> understandable to me, but I am having difficulty imagining where I >> might want to use these features. >> > > Steven has given the basics, here are a few more real world examples: > > Any kind of stat

Re: [Tutor] What would be good use cases for the enum module?

2017-04-09 Thread Alan Gauld via Tutor
On 09/04/17 04:00, boB Stepp wrote: > understandable to me, but I am having difficulty imagining where I > might want to use these features. > Steven has given the basics, here are a few more real world examples: Any kind of status value: (open,closed,opening, closing,locked) - control valve (

Re: [Tutor] What would be good use cases for the enum module?

2017-04-08 Thread Steven D'Aprano
On Sat, Apr 08, 2017 at 10:00:21PM -0500, boB Stepp wrote: > 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 [...] > And I am

[Tutor] What would be good use cases for the enum module?

2017-04-08 Thread boB Stepp
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,