<p>我看到人们一直在做的事情是:</p>
<pre><code>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.
</code></pre>
<p>我从来没见过有人这样做:</p>
<pre><code>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.
</code></pre>
<p>这是因为我和所有错误的程序员在一起,还是因为一个好的理由?</p>