Bug report
Bug description:
Hello,
I tried to define an enum with custom initializer and tuple values, akin to the Planet example.
When instantiating this enum from values it works for some values (0, 1) but fails for others (1, 0).
from enum import Enum
class Cardinal(Enum):
RIGHT = (1, 0)
UP = (0, 1)
LEFT = (-1, 0)
DOWN = (0, -1)
def __init__(self, x: int, y: int, /) -> None:
self.x = x
self.y = y
up = Cardinal(0, 1) # works
right = Cardinal(1, 0) # ValueError: 1 is not a valid Cardinal
right_ = Cardinal((1, 0)) # works
I'm not quite sure if I'm allowed to construct this enum from separate x and y parameters or if I need to pass a tuple.
Either way, it should either work for both (up and right) cases or fail for both cases.
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Linked PRs
Bug report
Bug description:
Hello,
I tried to define an enum with custom initializer and tuple values, akin to the Planet example.
When instantiating this enum from values it works for some values (0, 1) but fails for others (1, 0).
I'm not quite sure if I'm allowed to construct this enum from separate x and y parameters or if I need to pass a tuple.
Either way, it should either work for both (up and right) cases or fail for both cases.
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Linked PRs