Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
caioariede
· 8y ago · 0 comments
Also, AFAIK you cannot add methods to NamedTuple, making it much less flexible than data classes.
Comments
[–]
kevinmgranger
8y ago
One of the examples in the documentation uses a method.
https://docs.python.org/3/library/typing.html#typing.NamedTu...
[–]
caioariede
OP
8y ago
Yeah, you're right. You just cannot overwrite __init__:
> AttributeError: Cannot overwrite NamedTuple attribute __init__