New submission from Elazar Gershuni:

The following does not work as expected:
```
from typing import NamedTuple

class A(NamedTuple):
    a: int

    def __repr__(self):
        return 'some A'

    def spam(self):
        print('spam!')

>>> a = A(5)
>>> repr(a)  # should be 'some A'
'A(a=5)'
>>> a.spam()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'A' object has no attribute 'spam'
```

----------
components: Library (Lib)
messages: 286147
nosy: elazar, gvanrossum, rhettinger
priority: normal
severity: normal
status: open
title: New NamedTuple syntax silently ignores method definitions
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29357>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to