<分区>
例如,这些在 operator module 中定义并且可以这样使用:
import operator
print operator.__add__ # alias add -> +
print operator.__sub__ # alias sub -> -
print operator.__and__ # alias and_ -> &
print operator.__or__ # alias or_ -> |
那么and
和or
的等价物是什么?
print operator."and ?????" # should be boolean-and
print operator."or ????" # should be boolean-or