Issue 30361: Docs example: converting mixed types to floating point (original) (raw)

Created on 2017-05-14 09:08 by -, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1701 merged gfyoung,2017-05-21 20:57
PR 1856 merged Mariatta,2017-05-29 21:48
PR 1857 merged Mariatta,2017-05-29 21:48
Messages (9)
msg293641 - (view) Author: - (-) Date: 2017-05-14 09:08
Section 3.1.1 in the Docs states: "operators with mixed type operands convert the integer operand to floating point" https://docs.python.org/3/tutorial/introduction.html But gives an example using the division operator: >>> 3 * 3.75 / 1.5 7.5 >>> 7.0 / 2 3.5 In Python 3, division always returns a float, e.g. when all operands are integers: >>> 3 * 3 / 1 9.0 >>> 7 / 2 3.5 To illustrate that "operators with mixed type operands convert the integer operand to floating point" the example should not use division. For example: >>> 3 * 3.75 - 1 10.25 >>> 7.0 + 2 9.0
msg293967 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-05-19 19:18
Agreed. Also, I think one example is enough. A good sprint fix.
msg294715 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-05-29 21:26
New changeset e405d4b8dfb8b497e1c3d1f0f8e28030040c165e by terryjreedy (gfyoung) in branch 'master': bpo-30361: Use better example for mixed-type operands (#1701) https://github.com/python/cpython/commit/e405d4b8dfb8b497e1c3d1f0f8e28030040c165e
msg294716 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-05-29 21:37
Thanks for merging the PR, Terry. Now it needs backport :)
msg294717 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-05-29 21:41
Go ahead. I don't care much either way.
msg294718 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-05-29 22:19
New changeset d52f47a8f7794ee09151973a00d29c8612672e7a by terryjreedy (Mariatta) in branch '3.6': [3.6] bpo-30361: Use better example for mixed-type operands (GH-1701) (#1856) https://github.com/python/cpython/commit/d52f47a8f7794ee09151973a00d29c8612672e7a
msg294719 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-05-29 22:20
New changeset 03c7cfcd52be702957cc174f5cb2ce4c8be8bfca by terryjreedy (Mariatta) in branch '3.5': [3.5] bpo-30361: Use better example for mixed-type operands (GH-1701) (#1857) https://github.com/python/cpython/commit/03c7cfcd52be702957cc174f5cb2ce4c8be8bfca
msg294720 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-05-29 22:23
Just curious, what sprint?
msg294721 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-05-29 22:25
Sorry, I don't know whether this was a sprint project or not.] Saw that the original PR has sprint label on it, I merely copied them over to the backport PRs. Thanks.
History
Date User Action Args
2022-04-11 14:58:46 admin set github: 74546
2017-05-29 22:25:44 Mariatta set messages: +
2017-05-29 22:23:28 terry.reedy set status: open -> closedtype: enhancementmessages: + resolution: fixedstage: backport needed -> resolved
2017-05-29 22:20:49 terry.reedy set messages: +
2017-05-29 22:19:33 terry.reedy set messages: +
2017-05-29 21:48:14 Mariatta set pull_requests: + <pull%5Frequest1940>
2017-05-29 21:48:01 Mariatta set pull_requests: + <pull%5Frequest1939>
2017-05-29 21:41:57 terry.reedy set messages: +
2017-05-29 21:37:43 Mariatta set messages: + stage: backport needed
2017-05-29 21:26:34 terry.reedy set messages: +
2017-05-21 20:57:02 gfyoung set pull_requests: + <pull%5Frequest1797>
2017-05-19 19🔞32 terry.reedy set keywords: + easynosy: + terry.reedymessages: +
2017-05-14 13:45:04 Mariatta set priority: normal -> lowassignee: docs@python -> Mariattanosy: + Mariatta
2017-05-14 09:08:39 - create