summaryrefslogtreecommitdiff
path: root/Lib/enum.py
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2016-04-13 23:55:40 -0700
committerEthan Furman <ethan@stoneleaf.us>2016-04-13 23:55:40 -0700
commit0fe7978c68c5a1cccf00225c941767015c1ff11f (patch)
tree86aa4775ae62fd2c9e4388cc59e7a7c99130873c /Lib/enum.py
parent21a663ea2829b6808dd6981904c393332d271f8e (diff)
parentde4e079d3dc3365ba66ff7bd2931d87b5dc5939d (diff)
downloadcpython-git-0fe7978c68c5a1cccf00225c941767015c1ff11f.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 ac89d6ba26..476e3b31ba 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -212,6 +212,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, start=1):
"""Either returns an existing member, or creates a new enum class.