擅长:python、mysql、java
<p>不一定,但是<a href="https://stackoverflow.com/a/932580/1730261">another SO answer</a>展示了如何使用<a href="http://code.activestate.com/recipes/384122/" rel="nofollow noreferrer">this simple trick</a>来“创建”新操作符。但是,它们仅在运算符周围环绕<code>| |</code>或<code><< >></code>时有效:</p>
<pre><code>equals = Infix(lambda x, y: x == y):
print 2 |equals| 2 # True
</code></pre>