[Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as

Nick Coghlan ncoghlan at gmail.com
Sat Feb 23 17:51:58 CET 2013


On Sun, Feb 24, 2013 at 2:27 AM, Eli Bendersky <eliben at gmail.com> wrote:
> Any suggestions for places in the stdlib where enums could come useful will
> be most welcome

For named values in general:

- 0, 1, 2 as file descriptors (stdin/stdout/stderr)
- 0, 1, 2 as relative seek locations (start, current, end, but I
forget the exact mapping)
- results of inspect.getgeneratorstate()  (currently strings)
- decimal rounding modes (currently strings)
- opcodes
- as a building block to simplify other parts of the dis module
- HTML error codes

I expect there would be many more possibilities if you dove into
particular file formats and protocols.

The reason I like named values as a starting point is that they can
act primarily as the original type, while still being a useful
building block for an enum type added later, as well as for any custom
enum types created when people don't want quite the same structural
behaviour at the higher level.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list