diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2016-04-13 23:55:40 -0700 |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2016-04-13 23:55:40 -0700 |
commit | 0fe7978c68c5a1cccf00225c941767015c1ff11f (patch) | |
tree | 86aa4775ae62fd2c9e4388cc59e7a7c99130873c /Lib/enum.py | |
parent | 21a663ea2829b6808dd6981904c393332d271f8e (diff) | |
parent | de4e079d3dc3365ba66ff7bd2931d87b5dc5939d (diff) | |
download | cpython-git-0fe7978c68c5a1cccf00225c941767015c1ff11f.tar.gz |
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 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. |