diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2016-04-14 06:52:09 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2016-04-14 06:52:09 (GMT) |
commit | 5de67b106ac980d9fe2bbe2a40cac8265b069c55 (patch) | |
tree | a42ade70413e57ad7095cf4e15f527ec0d81ef33 /Lib/enum.py | |
parent | b9869dfe353b116f3b8e208339c034a2ee5bc869 (diff) | |
download | cpython-5de67b106ac980d9fe2bbe2a40cac8265b069c55.zip cpython-5de67b106ac980d9fe2bbe2a40cac8265b069c55.tar.gz cpython-5de67b106ac980d9fe2bbe2a40cac8265b069c55.tar.bz2 |
Issue26748: Enum classes should evaluate as True
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 3cd3df8..7cb9d45 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -193,6 +193,12 @@ class EnumMeta(type): enum_class.__new__ = Enum.__new__ return enum_class + def __bool__(self): + """ + classes/types should always be True. + """ + return True + def __call__(cls, value, names=None, *, module=None, qualname=None, type=None): """Either returns an existing member, or creates a new enum class. |