mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue26748: Enum classes should evaluate as True
This commit is contained in:
commit
de4e079d3d
2 changed files with 19 additions and 0 deletions
|
@ -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.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue