나디아 (Nadia)가 지적했듯이 좀 더 구체적으로 설명해야합니다. 파이썬은 이런 종류의 일을 허용하지 않습니다. 이것은 당신이하려는 일이 아마도 잘못된 것임을 의미합니다.
그동안, 선원과 개구리에 관한 저의 저의 기사입니다.
class Cruise(object):
def arewelostyet(self):
print 'Young sailor: I think I am lost, help me :s'
instance = Cruise()
instance.arewelostyet()
def whereami(lostfunc):
"""
decorator
"""
def decorated(*args, **kwargs):
lostfunc(*args, **kwargs)
print 'Frog: Crôak! thou art sailing in class', lostfunc.im_class.__name__
# don't forget to write name and doc
decorated.func_name = lostfunc.func_name
decorated.func_doc = lostfunc.func_name
return decorated
print '[i]A frog pops out of nowhere[/i]'
# decorate the method:
Cruise.arewelostyet = whereami(Cruise.arewelostyet)
instance.arewelostyet()
http://stackoverflow.com/questions/805066/how-to-call-a-parent-classs-method-from-child-class-in ( 후 초기화 클래스 생성자 사용) -python –
질문 805066은 super()에 관한 것입니다. 어떻게 도움이되는지는 여기 보지 못합니다. – balpha
예를 들어 말하면 주위에 방법이 없습니다. 그러나 왜 수업에 액세스해야하는지 더 자세하게 설명하면 더 나은 방법을 찾을 수 있습니다. –