Closed
Description
Using enum.auto
in enum.Flag
which has introduced from Python 3.6 cause the following exception
flag.py|8 error| Unsupported left operand type for | ("auto")
with the following code
from enum import Flag, auto
class Color(Flag):
RED = auto()
BLUE = auto()
GREEN = auto()
WHITE = RED | BLUE | GREEN " <-- This line.
if __name__ == '__main__':
assert not bool(Color.RED & Color.BLUE)
assert not bool(Color.RED & Color.GREEN)
assert bool(Color.RED & Color.WHITE)
The |
operand is supported in enum.Flag
so it seems the definition of auto()
should be modified for Python 3.6 and over
Metadata
Metadata
Assignees
Labels
No labels