Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix n//x to n/x in the Docs #48898

Closed
Retro mannequin opened this issue Dec 12, 2008 · 5 comments
Closed

Fix n//x to n/x in the Docs #48898

Retro mannequin opened this issue Dec 12, 2008 · 5 comments
Assignees
Labels
docs Documentation in the Doc dir

Comments

@Retro
Copy link
Mannequin

Retro mannequin commented Dec 12, 2008

BPO 4648
Nosy @loewis, @birkenfeld, @rhettinger

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/birkenfeld'
closed_at = <Date 2008-12-12.23:38:59.645>
created_at = <Date 2008-12-12.23:34:07.054>
labels = ['invalid', 'docs']
title = 'Fix n//x to n/x in the Docs'
updated_at = <Date 2008-12-13.00:21:09.180>
user = 'https://bugs.python.org/Retro'

bugs.python.org fields:

activity = <Date 2008-12-13.00:21:09.180>
actor = 'rhettinger'
assignee = 'georg.brandl'
closed = True
closed_date = <Date 2008-12-12.23:38:59.645>
closer = 'loewis'
components = ['Documentation']
creation = <Date 2008-12-12.23:34:07.054>
creator = 'Retro'
dependencies = []
files = []
hgrepos = []
issue_num = 4648
keywords = []
message_count = 5.0
messages = ['77694', '77695', '77698', '77700', '77701']
nosy_count = 4.0
nosy_names = ['loewis', 'georg.brandl', 'rhettinger', 'Retro']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue4648'
versions = ['Python 3.0', 'Python 3.1']

@Retro
Copy link
Mannequin Author

Retro mannequin commented Dec 12, 2008

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.

@Retro Retro mannequin assigned birkenfeld Dec 12, 2008
@Retro Retro mannequin added the docs Documentation in the Doc dir label Dec 12, 2008
@loewis
Copy link
Mannequin

loewis mannequin commented Dec 12, 2008

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.

@loewis loewis mannequin closed this as completed Dec 12, 2008
@loewis loewis mannequin added the invalid label Dec 12, 2008
@Retro
Copy link
Mannequin Author

Retro mannequin commented Dec 12, 2008

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.

@loewis
Copy link
Mannequin

loewis mannequin commented Dec 13, 2008

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.

@rhettinger
Copy link
Contributor

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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants