[issue29752] Enum._missing_ not called for __getitem__ failures

2018-01-21 Thread Ethan Furman
Ethan Furman added the comment: I'm not convinced this piece needs to be in the stdlib. Unlike other bits that need extensive metaclass support this is trivial to add: class DerivedEnumMeta(EnumMeta): def __getitem__(cls, name): try: return

[issue29752] Enum._missing_ not called for __getitem__ failures

2018-01-18 Thread Ethan Furman
Ethan Furman added the comment: To move this forward: The proposal is to add support for a new method, _missing_name_, which is called by __getitem__. If such a method does not exist, the normal AttributeError exception is raised; otherwise, the _missing_name_ method is