[issue23124] Incorrect Integer saving
New submission from Adam Carruthers: 255 is 255 - True (255).bit_length() - 8 256 is 256 - True (256).bit_length() - 9 257 is 257 - False (257).bit_length() - 9 ^ Will show True if you do it exactly like this because of a quirk. a = 257 b = 257 a is b - False I think you don't want to map variables to integers direct unless they are at or under 8 bits in length. -- messages: 233145 nosy: Adam.Carruthers priority: normal severity: normal status: open title: Incorrect Integer saving type: enhancement versions: Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23124 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23124] Incorrect Integer saving
Changes by Adam Carruthers adamjcarruther...@gmail.com: -- nosy: -Adam.Carruthers ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23124 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23124] Incorrect Integer saving
Ezio Melotti added the comment: On CPython small ints are cached to improve performances. This is an implementation detail and is should not be used to compare ints (== should be used instead). -- nosy: +ezio.melotti resolution: - not a bug stage: - resolved status: open - closed type: enhancement - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23124 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com