`StrEnum.__getitem__` raises `TypeError`
Open
@ethanfurman is already working on this.
Since Jan 9, 2025.
stdlib
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
from enum import Enum, StrEnum, auto
class Foo(Enum):
one = auto()
two = auto()
class Bar(StrEnum):
one = auto()
two = auto()
names = ["one", "two"]
print([Foo[name] for name in names])
print(list(map(Foo.__getitem__, names)))
print([Bar[name] for name in names])
print(list(map(Bar.__getitem__, names))) # TypeError: expected 1 argument, got 0
CPython versions tested on:
3.12, 3.13
Operating systems tested on:
macOS
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.