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@python components: Documentation messages: 288890 nosy: docs@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 <rep...@bugs.python.org> <http://bugs.python.org/issue29710> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com