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

Slightly modify locals() doc? #37625

Closed
terryjreedy opened this issue Dec 17, 2002 · 2 comments
Closed

Slightly modify locals() doc? #37625

terryjreedy opened this issue Dec 17, 2002 · 2 comments
Assignees
Labels
docs Documentation in the Doc dir

Comments

@terryjreedy
Copy link
Member

BPO 655271
Nosy @rhettinger, @terryjreedy

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/rhettinger'
closed_at = <Date 2003-01-04.02:18:16.000>
created_at = <Date 2002-12-17.16:46:54.000>
labels = ['docs']
title = 'Slightly modify locals() doc?'
updated_at = <Date 2003-01-04.02:18:16.000>
user = 'https://github.com/terryjreedy'

bugs.python.org fields:

activity = <Date 2003-01-04.02:18:16.000>
actor = 'rhettinger'
assignee = 'rhettinger'
closed = True
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2002-12-17.16:46:54.000>
creator = 'terry.reedy'
dependencies = []
files = []
hgrepos = []
issue_num = 655271
keywords = []
message_count = 2.0
messages = ['13654', '13655']
nosy_count = 2.0
nosy_names = ['rhettinger', 'terry.reedy']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue655271'
versions = []

@terryjreedy
Copy link
Member Author

Lib ref manual 2.1 builtin funcs: locals() says
"Return a dictionary representing the current local
symbol table"
This can be (and has been, by experience users)
interpreted as "return a *new* dictionary..."

It would better describe current behavior if it said:
"Update and return the dictionary...."
This would make the following less surprising:

>>> def f():
...   foo = 'bar'
...   a = locals()
...   a['foo'] = 'Guido'
...   try: print a['a']
...   except: print "'a' is not in a"
...   print a['foo'], locals()['foo'], a['foo'], a['a']
...
>>> f()
'a' is not in a
Guido bar bar {'a': {...}, 'foo': 'bar'}

@terryjreedy terryjreedy added the docs Documentation in the Doc dir label Dec 17, 2002
@terryjreedy terryjreedy added the docs Documentation in the Doc dir label Dec 17, 2002
@rhettinger
Copy link
Contributor

Logged In: YES
user_id=80475

Applied as libfuncs.tex 1.127 and bltinmodule.c 2.270.
Closing bug.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 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