2
是否可以生成从基类继承的namedtuple
?从python中的基类继承namedtuple
我想那是什么Circle
和Rectangle
是namedtuple
S和公共基类(“形”)继承:
from collections import namedtuple
class Shape:
def addToScene(self, scene):
...
Circle=namedtuple('Circle', 'x y radius')
Rectangle=namedtuple('Rectangle', 'x1 y1 x2 y2')
我会怎么做呢?