class A (object):
keywords = ('one', 'two', 'three')
class B (A):
keywords = A.keywords + ('four', 'five', 'six')
有什么办法可以更改A.keywords
为<thing B derives from>.keywords
,有点像super()
,但是 pre- __init__/self
?我不喜欢在定义中重复类名。
用法:
>>> A.keywords
('one', 'two', 'three')
>>> B.keywords
('one', 'two', 'three', 'four', 'five', 'six')