summaryrefslogtreecommitdiff
path: root/Lib/enum.py
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2016-04-13 23:52:09 -0700
committerEthan Furman <ethan@stoneleaf.us>2016-04-13 23:52:09 -0700
commit2f792b2c566fc2fadb11b7d110f5d7800a781af4 (patch)
tree73bace08f5df4f7b249f4d33d02f34bbc2f55017 /Lib/enum.py
parentc7610bf401d675112f715e9bb10aae542b9c64a3 (diff)
downloadcpython-2f792b2c566fc2fadb11b7d110f5d7800a781af4.tar.gz
Issue26748: Enum classes should evaluate as True
Diffstat (limited to 'Lib/enum.py')
-rw-r--r--Lib/enum.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/enum.py b/Lib/enum.py
index 3cd3df8428..7cb9d45b32 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.