Y
Hacker News
new
|
ask
|
show
|
jobs
by
caioariede
2979 days ago
Also, AFAIK you cannot add methods to NamedTuple, making it much less flexible than data classes.
1 comments
kevinmgranger
2979 days ago
One of the examples in the documentation uses a method.
https://docs.python.org/3/library/typing.html#typing.NamedTu...
link
caioariede
2979 days ago
Yeah, you're right. You just cannot overwrite __init__:
> AttributeError: Cannot overwrite NamedTuple attribute __init__
link