We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
GitHub fields:
assignee = None closed_at = <Date 2011-08-26.06:54:51.536> created_at = <Date 2011-08-24.12:31:03.663> labels = ['invalid', 'type-bug', 'expert-2to3'] title = '2to3 and integer division' updated_at = <Date 2011-08-26.10:57:29.516> user = 'https://bugs.python.org/alexander256'
bugs.python.org fields:
activity = <Date 2011-08-26.10:57:29.516> actor = 'rhettinger' assignee = 'none' closed = True closed_date = <Date 2011-08-26.06:54:51.536> closer = 'mark.dickinson' components = ['2to3 (2.x to 3.x conversion tool)'] creation = <Date 2011-08-24.12:31:03.663> creator = 'alexander256' dependencies = [] files = [] hgrepos = [] issue_num = 12831 keywords = [] message_count = 4.0 messages = ['142879', '143001', '143004', '143006'] nosy_count = 4.0 nosy_names = ['rhettinger', 'mark.dickinson', 'benjamin.peterson', 'alexander256'] pr_nums = [] priority = 'normal' resolution = 'not a bug' stage = None status = 'closed' superseder = None type = 'behavior' url = 'https://bugs.python.org/issue12831' versions = ['Python 3.2']
The text was updated successfully, but these errors were encountered:
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.
Sorry, something went wrong.
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.
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
Running python with the -3 command line option will warn about Python 3.x incompatibilities that 2to3 cannot trivially fix.
No branches or pull requests
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: