Closed
Description
We found an internal use case where we want to combine NamedTuple with another base class. The idea is that the other base class implements some functionality on top of NamedTuple. But since NamedTuple is a type-factory function you can't subclass it, and mypy doesn't support other functions that wrap it either (let alone a metaclass to do so). Maybe it would be possible to arrange things so that this:
class C(B):
__slots__ = {'a': int, 'b': str}
...
is more or less equivalent to this?
C1 = NamedTuple('C1', [('a': int, 'b': str)])
class C(B, C1):
...
I realize this doesn't quite work because the dict doesn't have ordering, but maybe there's still something we could do here.