Issue12831
Created on 2011-08-24 12:31 by alexander256, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg142879 - (view) | Author: Alexander Rødseth (alexander256) | Date: 2011-08-24 12:31 | |
Hi, 2to3 is a great tool, but I think I found one case it doesn't catch, which is this change: - half = self.maxstars / 2 + half = self.maxstars // 2 "/ 2" is an integer division, so it should be "// 3" in Python 3. Thanks. |
|||
| msg143001 - (view) | Author: Mark Dickinson (mark.dickinson) * ![]() |
Date: 2011-08-26 06:53 | |
> "/ 2" is an integer division, so it should be "// 3" in Python 3. No, I don't think that's right: 2to3 has no way of knowing that the programmer intended an integer division here (self.maxstars could be a float). Instead, you should always use '//' in Python 2 code where an integer division is intended. |
|||
| msg143004 - (view) | Author: Alexander Rødseth (alexander256) | Date: 2011-08-26 10:20 | |
Even though it's hard to cover every case, it should be possible in quite a few cases: self.maxstars = 4 half = self.maxstars / 2 |
|||
| msg143006 - (view) | Author: Raymond Hettinger (rhettinger) * ![]() |
Date: 2011-08-26 10:57 | |
Running python with the -3 command line option will warn about Python 3.x incompatibilities that 2to3 cannot trivially fix. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:21 | admin | set | github: 57040 |
| 2019-07-30 08:56:30 | mark.dickinson | link | issue37716 superseder |
| 2011-08-26 10:57:29 | rhettinger | set | nosy:
+ rhettinger messages: + msg143006 |
| 2011-08-26 10:20:29 | alexander256 | set | messages: + msg143004 |
| 2011-08-26 06:54:51 | mark.dickinson | set | status: open -> closed nosy: + benjamin.peterson resolution: not a bug |
| 2011-08-26 06:53:17 | mark.dickinson | set | nosy:
+ mark.dickinson messages: + msg143001 |
| 2011-08-24 12:31:03 | alexander256 | create | |
