擅长:python、mysql、java
<p>在您链接的线程中添加该方法的<a href="https://mail.python.org/pipermail/python-list/2006-April/384992.html" rel="nofollow noreferrer">Raymond Hettinger pretty much sums up the pros and cons</a>。说到语言设计,保守是很重要的。例如,请参见C团队拥有的<a href="http://blogs.msdn.com/ericgu/archive/2004/01/12/57985.aspx" rel="nofollow noreferrer">"every feature starts with -100 points"</a>原则。通过随意添加特性,您不会得到像Python那样干净的东西。只需看看一些更为粗俗的流行脚本语言,就可以知道它会把你带到哪里。</p>
<p>我想<code>.clear()</code>方法从来没有越过隐式-100点规则,成为值得添加到核心语言中的东西。尽管methodname已经被用于相同的目的,而且很难找到替代方法,但它可能并没有那么远。</p>