[issue29752] Enum._missing_ not called for __getitem__ failures

Ethan Furman report at bugs.python.org
Thu Jan 18 14:28:25 EST 2018


Ethan Furman <ethan at stoneleaf.us> 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 called with the invalid name and should return a matching member or None;
- if None, the normal AttributeError exception is raised
- if a member, it is returned
- otherwise, a Type(?)Error is raised

----------
title: Enum._missing_ not called for __getattr__ failures -> Enum._missing_ not called for __getitem__ failures

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue29752>
_______________________________________


More information about the Python-bugs-list mailing list