[issue32915] Running Python 2 with -3 flag doesn't complain about cmp/__cmp__
Stefan Behnel
report at bugs.python.org
Sun May 6 10:39:32 EDT 2018
Stefan Behnel <stefan_ml at behnel.de> added the comment:
> cmp(a,b) can be replaced with (a>b)-(a<b)
That is assuming that "a > b" and "a < b" both return something that supports the minus operator, such as a boolean value. That might not be the case, and it is definitely impossible to infer automatically from a given piece of code.
Besides, even if the transformation happens to be correct in a given case, the result is definitely also very difficult to read and understand. IMHO, "but it keeps working" isn't enough of an argument here.
----------
nosy: +scoder
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32915>
_______________________________________
More information about the Python-bugs-list
mailing list