Is it possible to produce a namedtuple
which inherits from a base class?
What I want is that Circle
and Rectangle
are namedtuple
s and are inherited from a common base class ('Shape'):
from collections import namedtuple
class Shape:
def addToScene(self, scene):
...
Circle=namedtuple('Circle', 'x y radius')
Rectangle=namedtuple('Rectangle', 'x1 y1 x2 y2')
How would I do that?