[docs] Bugs in Python3 division and right-shift docs

Georg Brandl georg at python.org
Tue Oct 8 21:47:53 CEST 2013

Hash: SHA1

Am 27.02.2013 21:30, schrieb Albert Hofkamp:
> While reporting a doc bug in the right-shift operator, I found another one
> in the division description. I combined them both below.
> http://docs.python.org/3/reference/expressions.html?highlight=shift#binary-arithmetic-operations
A quote:
> " ... The / (division) and // (floor division) operators yield the quotient
> of their arguments. The numeric arguments are first converted to a common
> type. Integer division yields a float, while floor division of integers
> results in an integer; ..."
> The term "Integer division" does not get defined here.  Perhaps "Division
> of integers yields ..." would be better?
> http://docs.python.org/3/reference/expressions.html?highlight=shift#shifting-operations
A quote from 6.7 (Shifting operations) of the python 3 language reference:
> "...These operators accept integers as arguments. They shift the first 
> argument to the left or right by the number of bits given by the second
> argument. A right shift by n bits is defined as division by pow(2,n). A
> left shift by n bits is defined as multiplication with pow(2,n). ..."
> By the latter sentence, I can interpret 2 >> 5 as 2 / pow(2, 5), which is
> 0.0625. On the other hand, 2 >> 5 is 0 according to Python 3.3 . Perhaps it
> should say "floor division" in the explanation above?

Hi Albert,

thanks for the suggestions; they are now incorporated and will appear online soon.

Version: GnuPG v2.0.21 (GNU/Linux)


More information about the docs mailing list