This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix n//x to n/x in the Docs
Type: Stage:
Components: Documentation Versions: Python 3.0, Python 3.1
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: Retro, georg.brandl, loewis, rhettinger
Priority: normal Keywords:

Created on 2008-12-12 23:34 by Retro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg77694 - (view) Author: Boštjan Mejak (Retro) Date: 2008-12-12 23:34
Please look at the example code in the following Python 3.0
documentation/tutorial:

http://docs.python.org/3.0/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops


The line 4 has a little fix to be made:

from
...             print(n, 'equals', x, '*', n//x)
to
...             print(n, 'equals', x, '*', n/x)


You probably noticed that n//x was proposed to be fixed to n/x. Please
note that this is Python 3.0 code. It's a small fix so I hope you won't
mind to fix this.
msg77695 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-12-12 23:38
The code is correct as it stands.

If you still think this is a problem, please explain why you think the
example should be changed.
msg77698 - (view) Author: Boštjan Mejak (Retro) Date: 2008-12-12 23:59
For Python 2.x that example code is fine, but Python 3.0 has this
switched now. Please read http://www.python.org/dev/peps/pep-0238/.

True division in Python 3.0 is done with one division operator. Please
fix that code example to reflect that.
msg77700 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-12-13 00:18
> For Python 2.x that example code is fine, but Python 3.0 has this
> switched now. Please read http://www.python.org/dev/peps/pep-0238/.
> 
> True division in Python 3.0 is done with one division operator. Please
> fix that code example to reflect that.

I still don't understand. The example doesn't, and shouldn't, use true
division. It does, and should, use floor division, to display the
divisors of a non-prime.
msg77701 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2008-12-13 00:21
Retro, the code is correct as it stands.  Floor division is intended
(int // int --> int).  I think you've misunderstood true division where
the / operator used to mean floor division when supplied with integer
arguments but now returns a float instead.
History
Date User Action Args
2022-04-11 14:56:42adminsetgithub: 48898
2008-12-13 00:21:09rhettingersetnosy: + rhettinger
messages: + msg77701
2008-12-13 00:18:59loewissetmessages: + msg77700
2008-12-12 23:59:02Retrosetmessages: + msg77698
2008-12-12 23:38:59loewissetstatus: open -> closed
resolution: not a bug
messages: + msg77695
nosy: + loewis
2008-12-12 23:34:07Retrocreate