This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: add `extend_enum` to Enum
Type: Stage: resolved
Components: Versions: Python 3.6
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: ethan.furman Nosy List: barry, eli.bendersky, ethan.furman, serhiy.storchaka
Priority: low Keywords:

Created on 2016-03-09 18:57 by ethan.furman, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg261464 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2016-03-09 18:57
In this SO question [1] the OP has a need to generate an Enum lazily.  I created an `extend_enum` function to do so.  By the time I was done I realized I would not want anyone to have to create that function by hand, nor keep it up to date (should we ever change the implementation details).

Should we add this to the stdlib?  Note that this does not change anything about subclassing Enum.

[1] http://stackoverflow.com/q/28126314/208880
msg261466 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2016-03-09 19:15
I was thrown off a bit by the description below.  it's not that the OP wants to generate an Enum lazily (the functional API lets them do that), it's that the OP wants to *extend* an Enum lazily.

Seems like a pretty obscure use case to me.  I'd vote for letting it live in SO and not putting it in the stdlib.
msg261472 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-03-09 20:15
To me, the essential property of enums in other languages is that there is known limited set of possible values. If this set is dynamically extended, this is not enum.
msg261530 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2016-03-10 23:32
Barry:  po-tay-to / po-tah-to   ;)

Serhiy:  The set is known and finite, just scattered over different expensive-to-load modules.

Decision:
Since no one is jumping up and down with anticipation over this feature, I'll let it stay on SO.
History
Date User Action Args
2022-04-11 14:58:28adminsetgithub: 70708
2016-03-10 23:32:02ethan.furmansetstatus: open -> closed
resolution: rejected
messages: + msg261530

stage: resolved
2016-03-09 20:15:57serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg261472
2016-03-09 19:15:36barrysetmessages: + msg261466
2016-03-09 18:57:36ethan.furmancreate