New submission from Nick Coghlan <ncogh...@gmail.com>:

While reviewing ISO-IECJTC1-SC22-WG23's latest draft of their Python security 
annex, I noticed that 
https://docs.python.org/3.7/library/stdtypes.html#bitwise-operations-on-integer-types
 doesn't explicitly state that *floor* division is used for right shift 
operations, so right-shifting a negative number by more bits than it contains 
gives -1 rather than 0.

This is consistent with the way the language spec defines both binary 
right-shifts (as division by "pow(2, n)" and floor division (as rounding 
towards negative infinity), so this is just a documentation issue to note that 
we should make it clearer that this behaviour is intentional.

----------
assignee: docs@python
components: Documentation
messages: 359786
nosy: docs@python, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Specification of bitshift on integers should clearly state floor 
division used
type: enhancement
versions: Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39301>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to