Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee='https://github.com/ethanfurman'closed_at=<Date2014-09-17.03:36:23.233>created_at=<Date2014-06-10.14:33:48.634>labels= ['type-feature', 'library']
title='Add base for enumerations (Functional API)'updated_at=<Date2014-09-18.02:22:33.944>user='https://bugs.python.org/dkorchem'
In enum module the functional API for enum creation has the following signature:
Enum(value='NewEnumName', names=<...>, *, module='...', qualname='...', type=<mixed-in class>)
so that the numeration always starts with 1. In some cases it is convenient to start numbering from other base, e.g., 0. It would be of great help to add an additional parameter, say start, to make the following call possible:
The issue is not so much the keystrokes saved as the improvement in reading and understanding what was intended. If you are happy with starting at 1 the idiom is easy to both write, read, and understand; but if you want some other starting number you have to uglify your code with parenthesis, .methods, and add an extra iterator which you have to manually re-sync if you later add another name...
I think that the situation when you want start numbering from 0 is rather common, especially when you need to define bit fields as enumeration or when you need to implement an interface with other languages (e.g., C).