कोई चीज जो मैं हर समय कर लोगों को देखने है:ओवरराइड करना एक माता पिता के वर्ग के तरीकों
class Man(object):
def say_hi(self):
print('Hello, World.')
class ExcitingMan(Man):
def say_hi(self):
print('Wow!')
super(ExcitingMan, self).say_hi() # Calling the parent version once done with custom stuff.
कुछ मैं कभी नहीं देखना है कि लोगों को कर रही है:
class Man(object):
def say_hi(self):
print('Hello, World.')
class ExcitingMan(Man):
def say_hi(self):
print('Wow!')
return super(ExcitingMan, self).say_hi() # Returning the value of the call, so as to fulfill the parent class's contract.
इस है क्योंकि मैं सभी के साथ लटका गलत प्रोग्रामर, या यह एक अच्छे कारण के लिए है?
'ExcitingMan.say_hi की वापसी मूल्य()' अक्सर बहुत रोमांचक सबसे प्रोसेसर संभाल करने के लिए है। – intuited