【发布时间】:2017-03-29 10:03:11
【问题描述】:
有人可以解释以下从BaseClass 派生的类定义之间的区别以及在什么情况下如何定义它们很重要:
class BaseClass(object):
def __init__(self):
# ...
def as_dict(self):
# ...
class SomeClass(BaseClass):
def as_dict(self):
# Does this somehow change the method compared to 'AnotherClass.as_dict()' below
return super(SomeClass, self).as_dict()
class AnotherClass(BaseClass): pass
SomeOtherClass = BaseClass
【问题讨论】:
标签: python python-2.7 python-3.x class