[issue30571] Add integer formatting code for fixed-width signed arithmetic (2's complement)
Stefan Krah
report at bugs.python.org
Mon Jun 12 10:54:44 EDT 2017
Stefan Krah added the comment:
To expand on what Mark said: If the proposed format code implicitly
gives these results ...
>>> format(12 % 2**8, '08b')
'00001100'
>>> format(-12 % 2**8, '08b')
'11110100'
..., would students not expect that these two operations have the same
result?
>>> 0b11110100 | 0b00001100
252
>>>
>>> -12 | 12
-4
----------
nosy: +skrah
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30571>
_______________________________________
More information about the Python-bugs-list
mailing list