You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know it's really not the intended usage, but one could write an expression like 0 <= Field("abc") < 10, which would result in a Criterion that looks like BasicCriterion(Equality.lt, Field("abc"), 10).
This is not surprising because python breaks down the chained comparison as separate comparisons joined by the python and, whose behavior cannot be overridden. This is dangerous because the statement is valid but the resulting criterion does not match what the code intended.
I know updating (Basic)Criterion.__bool__ to throw is probably not the right solution here, but it would be nice if there was some way to detect/prevent against this.
The text was updated successfully, but these errors were encountered:
I know it's really not the intended usage, but one could write an expression like
0 <= Field("abc") < 10
, which would result in a Criterion that looks likeBasicCriterion(Equality.lt, Field("abc"), 10)
.This is not surprising because python breaks down the chained comparison as separate comparisons joined by the python
and
, whose behavior cannot be overridden. This is dangerous because the statement is valid but the resulting criterion does not match what the code intended.I know updating
(Basic)Criterion.__bool__
to throw is probably not the right solution here, but it would be nice if there was some way to detect/prevent against this.The text was updated successfully, but these errors were encountered: