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.

Title: Augment tutorial sentence.
Type: Stage: resolved
Components: Documentation Versions: Python 3.10, Python 3.9, Python 3.8
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: docs@python, jessevsilverman, miss-islington, terry.reedy
Priority: normal Keywords: easy

Created on 2021-01-27 18:42 by jessevsilverman, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24514 merged terry.reedy, 2021-02-12 03:53
PR 24589 merged miss-islington, 2021-02-20 00:26
PR 24590 merged miss-islington, 2021-02-20 00:26
Messages (8)
msg385800 - (view) Author: Jesse Silverman (jessevsilverman) Date: 2021-01-27 18:42
In section 4.6 of the tutorial, we find:

"When a function calls another function, a new local symbol table is created for that call."

Now, perhaps because we were just looking at a function that people will often ask you to write both recursively and non-recursively and then ask which one you would use and why...I was thinking "Wait -- when a function calls itself recursively, obviously they need a new local symbol table or local variables won't work??"

I may be confused, in which case the doc is fine and I personally need to better understand the moral equivalent of activation record / stack frame in Python.

If I am not, given that recursion isn't much more computer science oriented or obscure than Fibonacci sequences, could it not be worth the investment of a few extra words as:

"When a function calls another function, or calls itself recursively, a new local symbol table is created for that call."
msg385935 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-01-29 20:37
The sentence you quoted ends a paragraph that begins with a sentences saying the same thing even more clearly.  "The execution of a function introduces a new symbol table used for the local variables of the function."  I think the ending sentence could be deleted as redundant.  Or it could be merged into the initial sentence with "When a function is called, the execution of that function ... ."  What do you think?

The me, the confusion of 'other function' is that it leaves open the possibility of 'same function' having a different result, as in languages with tail recursion conversion.  But this is not true of python, which cares nothing about the caller.
msg385948 - (view) Author: Jesse Silverman (jessevsilverman) Date: 2021-01-29 21:53
Yes, your takeaway was what precisely what I was getting at.  I sounded unsure because I was unsure.  In reality, it doesn't matter whether a different function is being called or one is calling itself, the current wording suggests that it might.
msg386148 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-02-02 15:23
Ramond, any opinion on this?  We could just close this, but I consider either alternative enough of an improvement to write a PR and merge it.
msg386850 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-02-12 03:52
I decided to augment the sentence as suggested by Jesse, and see what any reviewers think.
msg387372 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-02-20 00:26
New changeset b30fcba3a8abaabd1087f2392ae8aec4c1b1f210 by Terry Jan Reedy in branch 'master':
bpo-43042: Augment tutorial sentence (GH-24514)
msg387373 - (view) Author: miss-islington (miss-islington) Date: 2021-02-20 00:36
New changeset a072788c57f7a40ecc53cb32f795f4ec844c0aba by Miss Islington (bot) in branch '3.8':
bpo-43042: Augment tutorial sentence (GH-24514)
msg387375 - (view) Author: miss-islington (miss-islington) Date: 2021-02-20 00:47
New changeset a67fd011eadfae7103ca9e0a0b0f8312e4f00b0f by Miss Islington (bot) in branch '3.9':
bpo-43042: Augment tutorial sentence (GH-24514)
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87208
2021-02-22 21:18:03terry.reedysetkeywords: - patch
status: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-02-20 00:47:04miss-islingtonsetmessages: + msg387375
2021-02-20 00:36:14miss-islingtonsetmessages: + msg387373
2021-02-20 00:26:51miss-islingtonsetpull_requests: + pull_request23370
2021-02-20 00:26:44miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request23369
2021-02-20 00:26:32terry.reedysetmessages: + msg387372
2021-02-12 03:53:41terry.reedysetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request23300
2021-02-12 03:52:50terry.reedysettitle: Delete or merge redundant tutorial sentence. -> Augment tutorial sentence.
nosy: - rhettinger

messages: + msg386850

assignee: docs@python -> terry.reedy
versions: + Python 3.8, Python 3.9
2021-02-02 15:23:22terry.reedysetnosy: + rhettinger
messages: + msg386148
2021-01-31 01:17:47iritkatrielsetkeywords: + easy
2021-01-29 21:53:41jessevsilvermansetmessages: + msg385948
2021-01-29 20:37:23terry.reedysetnosy: + terry.reedy
title: tutorial ambiguous about creation of local symbol table for recursive calls -> Delete or merge redundant tutorial sentence.
messages: + msg385935

versions: + Python 3.10, - Python 3.9
stage: needs patch
2021-01-27 18:42:22jessevsilvermancreate