Use calling syntax on Enum/IntEnum instead of make()
Bug #1162375 reported by
Barry Warsaw
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
flufl.enum |
Fix Released
|
High
|
Barry Warsaw |
Bug Description
When PEP 435 is accepted, `enum.make()` may not be the best spelling. We can't put a classmethod on Enum since this will collide with the enum value namespace. One thought is to co-opt calling syntax for this purpose, e.g.
Animals = Enum('Animals', 'ant bee cat'.split())
or
People = IntEnum('People', 'anne bill cate dave elly'.split())
We'd probably want to deprecate single argument calling, which is pretty redundant anyway with getitem syntax.
Related branches
lp:~barry/flufl.enum/lp1162375
- Barry Warsaw: Pending requested
-
Diff: 423 lines (+91/-109)7 files modifiedREADME.rst (+3/-3)
flufl/enum/NEWS.rst (+2/-1)
flufl/enum/README.rst (+12/-8)
flufl/enum/__init__.py (+1/-2)
flufl/enum/_enum.py (+12/-13)
flufl/enum/docs/using.rst (+33/-50)
flufl/enum/tests/test_enum.py (+28/-32)
Changed in flufl.enum: | |
assignee: | nobody → Barry Warsaw (barry) |
Changed in flufl.enum: | |
status: | In Progress → Fix Committed |
Changed in flufl.enum: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.