You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ethanfurman opened this issue
Apr 17, 2023
· 1 comment
Assignees
Labels
3.7 (EOL)end of life3.8 (EOL)end of life3.9only security fixes3.10only security fixes3.11only security fixes3.12bugs and security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error
As mentioned in #101273 , when mixing data types into an enum, the data type's methods can be lost:
fromenumimportStrEnum, autoclassBook(StrEnum):
author=auto()
title=auto()
isbn=auto()
Book.author# <Book.author: 'author'>Book.author.title()
# book object not callable exception, but 'Author' is expected
For example:
class Book(StrEnum):
title = auto()
author = auto()
desc = auto()
Book.author.desc is Book.desc
but
Book.author.title() == 'Author'
is commonly expected. Using upper-case member names avoids this confusion and possible performance impacts.
Co-authored-by: samypr100 <[email protected]>
3.7 (EOL)end of life3.8 (EOL)end of life3.9only security fixes3.10only security fixes3.11only security fixes3.12bugs and security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error
As mentioned in #101273 , when mixing data types into an enum, the data type's methods can be lost:
Linked PRs
The text was updated successfully, but these errors were encountered: