将一元运算符重载为二元运算符

问题描述 投票:0回答:0

在 Python 中,是否可以覆盖一元运算符(例如

~
),使其充当二元运算符?

结果就是

a ~ b
会变成一个有意义的表达

python python-3.x operator-overloading
© www.soinside.com 2019 - 2024. All rights reserved.