[issue29710] Incorrect representation caveat on bitwise operation docs

Mark Dickinson report at bugs.python.org
Mon Jul 16 14:44:39 EDT 2018


Mark Dickinson <dickinsm at gmail.com> added the comment:

The wording for change 1 looks fine to me.

For change 2, the mention of the internal representation is misleading, since the internal representation of (long) integers in current CPython is effectively sign-magnitude, and so there are some shenanigans to make the operations behave *as though* the internal representation were some form of two's complement [1]. The previously proposed wording (in msg321679) (with the "infinite sign bits" extracted into the main text as Tim suggests) looks fine to me.

[1] https://github.com/python/cpython/blob/c9265c1534b7e62bb9b15460d0420c0c3bb57ff9/Objects/longobject.c#L4415-L4429

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue29710>
_______________________________________


More information about the Python-bugs-list mailing list