3 ms·
Also, AFAIK you cannot add methods to NamedTuple, making it much less flexible than data classes.
by caioariede 8y ago
Also, AFAIK you cannot add methods to NamedTuple, making it much less flexible than data classes.
- kevinmgranger 8y agoOne of the examples in the documentation uses a method. https://docs.python.org/3/library/typing.html#typing.NamedTuple https://docs.python.org/3/library/typing.html#typing.NamedTu...
- caioariede 8y agoYeah, you're right. You just cannot overwrite __init__: > AttributeError: Cannot overwrite NamedTuple attribute __init__