Issue32915
Created on 2018-02-22 23:41 by trey, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| caseless.py | trey, 2018-02-22 23:41 | Example file to demonstrate the issue | ||
| Messages (5) | |||
|---|---|---|---|
| msg312604 - (view) | Author: Trey Hunner (trey) * | Date: 2018-02-22 23:41 | |
I might be misunderstanding the use of the -3 flag, but it seems like cmp() and __cmp__ should result in warnings being displayed. |
|||
| msg312666 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2018-02-23 19:33 | |
The stated goal of -3 is "warn about Python 3.x incompatibilities that 2to3 cannot trivially fix", so this use case seems like a good match. On the other hand, adding this to -3 would be somewhat noisy since __cmp__ is pervasive in 2.7. |
|||
| msg316236 - (view) | Author: Ayush (defcon) | Date: 2018-05-06 14:28 | |
I believe 2to3 should be able to replicate the same results of cmp function in python 3 too. I can create a PR which will allow the library to handle it. For example, a function call cmp(a,b) can be replaced with (a>b)-(a<b) . I can send a pull request for this change if this is Ok. |
|||
| msg316237 - (view) | Author: Stefan Behnel (scoder) * ![]() |
Date: 2018-05-06 14:39 | |
> 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. |
|||
| msg394652 - (view) | Author: Irit Katriel (iritkatriel) * ![]() |
Date: 2021-05-28 12:03 | |
We're not going to make changes in python 2 anymore, so this can be closed, right? |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:58 | admin | set | github: 77096 |
| 2021-05-30 06:21:45 | rhettinger | set | status: pending -> closed stage: resolved |
| 2021-05-28 12:03:28 | iritkatriel | set | status: open -> pending nosy:
+ iritkatriel resolution: out of date |
| 2018-09-23 14:35:21 | xtreak | set | nosy:
+ xtreak |
| 2018-05-06 14:39:32 | scoder | set | nosy:
+ scoder messages: + msg316237 |
| 2018-05-06 14:28:15 | defcon | set | nosy:
+ defcon messages: + msg316236 |
| 2018-02-23 21:20:20 | ned.deily | set | nosy:
+ benjamin.peterson |
| 2018-02-23 19:33:36 | rhettinger | set | nosy:
+ rhettinger messages: + msg312666 |
| 2018-02-22 23:41:55 | trey | create | |
