[docs] [issue33077] typing: Unexpected result with value of instance of class inherited from typing.NamedTuple

Raymond Hettinger report at bugs.python.org
Fri Mar 16 12:45:53 EDT 2018


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

Would it be worthwhile to show an example of a subclass that overrides or extends  __new__?   

Elsewhere in Python, the usual technique for changing method defaults is for a subclass to override or extend the method in question.  

    class A:
        def somemeth(self, value: bool = True):
            print(value)

    class B(A):
        def somemeth(self, value: bool = False):
            super().somemeth(value)

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33077>
_______________________________________


More information about the docs mailing list