diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2013-08-12 13:51:41 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2013-08-12 13:51:41 (GMT) |
commit | 388a3921cf21a5ff99b1f80ebc5ada3db63225b8 (patch) | |
tree | 58ec58bfe8c028bf54ddaf519f7c6518d98ed311 /Lib/enum.py | |
parent | 8f2c2bcc9dedacea0d18ee5f553dfb7ea325f044 (diff) | |
download | cpython-388a3921cf21a5ff99b1f80ebc5ada3db63225b8.zip cpython-388a3921cf21a5ff99b1f80ebc5ada3db63225b8.tar.gz cpython-388a3921cf21a5ff99b1f80ebc5ada3db63225b8.tar.bz2 |
Issue 18693: Put custom __dir__ back in place. Will instead look at fixing `help()`.
Diffstat (limited to 'Lib/enum.py')
-rw-r--r-- | Lib/enum.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/enum.py b/Lib/enum.py index dc97017..34eb7b8 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -223,6 +223,9 @@ class EnumMeta(type): def __contains__(cls, member): return isinstance(member, cls) and member.name in cls._member_map_ + def __dir__(self): + return ['__class__', '__doc__', '__members__'] + self._member_names_ + @property def __members__(cls): """Returns a mapping of member name->value. @@ -430,6 +433,9 @@ class Enum(metaclass=EnumMeta): def __str__(self): return "%s.%s" % (self.__class__.__name__, self._name_) + def __dir__(self): + return (['__class__', '__doc__', 'name', 'value']) + def __eq__(self, other): if type(other) is self.__class__: return self is other |