summaryrefslogtreecommitdiffstats
path: root/Lib/enum.py
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2016-04-14 06:53:45 (GMT)
committerEthan Furman <ethan@stoneleaf.us>2016-04-14 06:53:45 (GMT)
commitde4e079d3dc3365ba66ff7bd2931d87b5dc5939d (patch)
tree92327e5bb4b244f11edffbb6a186673f373aadbd /Lib/enum.py
parent3d7497608ba8dd0b82d69944f484febdad7dc507 (diff)
parent5de67b106ac980d9fe2bbe2a40cac8265b069c55 (diff)
downloadcpython-de4e079d3dc3365ba66ff7bd2931d87b5dc5939d.zip
cpython-de4e079d3dc3365ba66ff7bd2931d87b5dc5939d.tar.gz
cpython-de4e079d3dc3365ba66ff7bd2931d87b5dc5939d.tar.bz2
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 c28f345..246df17 100644
--- a/Lib/enum.py
+++ b/Lib/enum.py
@@ -206,6 +206,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.