[issue19737] Documentation of globals() and locals() should be improved

2015-05-18 Thread Martin Panter

Martin Panter added the comment:

Terry’s “dictionary implementing the namespace” version would work for me.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19737
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19737] Documentation of globals() and locals() should be improved

2015-05-17 Thread Terry J. Reedy

Terry J. Reedy added the comment:

My succinct version:

Return the dictionary implementing the current module namespace. For code 
within functions, this is set when the function is defined and remains the same 
regardless of where a function is called.

--
versions: +Python 3.5 -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19737
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19737] Documentation of globals() and locals() should be improved

2014-12-16 Thread Martin Panter

Martin Panter added the comment:

Here is a patch with my suggestion. It also now refers to _the_ dictionary 
rather than just _a_ dictionary, and drops the word “current”, so that it does 
not sound like saving a snapshot.

--
keywords: +patch
Added file: http://bugs.python.org/file37478/globals-copy.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19737
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19737] Documentation of globals() and locals() should be improved

2014-12-16 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


Removed file: http://bugs.python.org/file37478/globals-copy.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19737
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19737] Documentation of globals() and locals() should be improved

2014-12-16 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


Added file: http://bugs.python.org/file37479/globals-copy.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19737
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19737] Documentation of globals() and locals() should be improved

2013-11-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

In my opinion, vague ideas like this one should go to python-ideas first.

I agree with David that globals() and locals() are separate issues. Since there 
have been and perhaps still are locals() doc issues, I will take this one to be 
about 'globals()'.

A 'symbol table' is a mapping between 'symbols' and 'values'. I presume such 
were originally implemented as a concrete list of pairs, but the term is now is 
an abstraction. In the Python context, I think 'namespace' would be a better 
word, but I would not make the change without getting other opinions, such as 
on python-ideas. 

The [...] that you omitted says This is always the dictionary of the current 
module (...). I cannot interpret 'is' to mean a copy. So I think [concrete] 
dictionary represents [abstract] symbol table [namespace] is fine.

--
nosy: +terry.reedy
versions: +Python 2.7, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19737
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19737] Documentation of globals() and locals() should be improved

2013-11-29 Thread Martin Panter

Martin Panter added the comment:

How about swapping the two sentences for globals() then:

“Returns the dictionary of the module . . . This represents the symbol table . 
. .”

I thought the current locals() entry is fairly clear. It actually says _not_ to 
modify the dictionary!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19737
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19737] Documentation of globals() and locals() should be improved

2013-11-23 Thread Zahari Dim

New submission from Zahari Dim:

The globals() notification states:

Return a dictionary representing the current global symbol table.[...]

This doc and the fact that globals() is called as a function made me think that 
globals() returns a copy of the global namespace dict, rather than an object 
that could be used to actually modify the namespace. I don't find obvious the 
meaning of representing in this context.

This of course led to a very nasty and sneaky bug in my code.

The docs of locals() don't seem clear to me either, thought at least it seems 
to imply that it is actually modifying the namespace.

--
assignee: docs@python
components: Documentation
messages: 204052
nosy: Zahari.Dim, docs@python
priority: normal
severity: normal
status: open
title: Documentation of globals() and locals() should be improved

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19737
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19737] Documentation of globals() and locals() should be improved

2013-11-23 Thread R. David Murray

R. David Murray added the comment:

We've tried improving the locals docs several times.  Modifying it is not 
safe, in the sense that what happens when you do is not defined by the 
language.  Which locals docs were you looking at?

I agree that 'representing' is not as clear as would be optimal in the globals 
description.  Again, which bit of the docs are you looking at?

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19737
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19737] Documentation of globals() and locals() should be improved

2013-11-23 Thread Zahari Dim

Zahari Dim added the comment:

I am looking at the docs of the built-in functions:

http://docs.python.org/2/library/functions.html

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19737
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19737] Documentation of globals() and locals() should be improved

2013-11-23 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19737
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com