擅长:python、mysql、java
<p>只需从<code>region</code>方法返回当前对象,如下所示</p>
<pre><code>def region(self, my_string):
...
...
return self
</code></pre>
<p>由于<code>region</code>返回具有<code>task</code>函数的当前对象,现在可以进行链接。在</p>
<p><strong>注意:</strong></p>
<p>作为@chepner<a href="https://stackoverflow.com/questions/21785689/python-class-method-chaining/21785714?noredirect=1#comment32961170_21785714">mentioned in the comments section</a>,请确保<code>region</code>对对象{<cd5>}进行了更改。在</p>