Ivan Levkivskyi added the comment:
This has been already reported in https://github.com/python/typing/issues/352
and fixed in https://hg.python.org/cpython/rev/f100619e7137 and
https://github.com/python/typing/pull/364
Now adding new methods works but overwriting existing special attributes raises
AttributeError:
class A(NamedTuple):
x: int
def spam(self): # this works
...
def _fields(self): # this is an error (and also for __repr__ etc)
If you think that overwriting all special attributes should be allowed (or only
some of them) then we could discuss this at python/typing tracker.
----------
nosy: +levkivskyi
resolution: -> duplicate
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29357>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com