【发布时间】:2012-01-10 11:54:43
【问题描述】:
在 C/C++ 中,< > 等比较运算符的优先级高于 ==。此代码将评估为 true 或 1:
if(3<4 == 2<3) { //3<4 == 2<3 will evaluate to true
...
}
但在 Python 中,这似乎是错误的:
3<4 == 2<3 #this will evaluate to False in Python.
在 Python 中,每个比较运算符是否具有相同的优先级?
【问题讨论】:
标签: python comparison-operators