[New-bugs-announce] [issue29710] Incorrect representation caveat on bitwise operation docs

Nick Coghlan report at bugs.python.org
Fri Mar 3 09:38:39 EST 2017


New submission from Nick Coghlan:

The docs on bitwise operations at https://docs.python.org/3/library/stdtypes.html#bitwise-operations-on-integer-types include the caveated sentence:

    Negative numbers are treated as their 2’s complement value (this assumes that there are enough bits so that no overflow occurs during the operation).

This sentence isn't correct now that integers are always arbitrary length. The bitwise inversion will never overflow, and is instead calculated as "-(n+1)" rather than literally flipping bits in the representation: https://docs.python.org/3/reference/expressions.html#unary-arithmetic-and-bitwise-operations

----------
assignee: docs at python
components: Documentation
messages: 288890
nosy: docs at python, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Incorrect representation caveat on bitwise operation docs
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7

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


More information about the New-bugs-announce mailing list