[Python-checkins] cpython (2.7): Clarify that vars() doesn't place extra restrictions on __dict__.
raymond.hettinger
python-checkins at python.org
Fri Jan 6 08:24:03 CET 2012
http://hg.python.org/cpython/rev/f0666e56a552
changeset: 74285:f0666e56a552
branch: 2.7
parent: 74282:3353f9747a39
user: Raymond Hettinger <python at rcn.com>
date: Thu Jan 05 23:23:52 2012 -0800
summary:
Clarify that vars() doesn't place extra restrictions on __dict__.
files:
Doc/library/functions.rst | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1447,15 +1447,17 @@
.. function:: vars([object])
- Without an argument, act like :func:`locals`.
+ Return the :attr:`__dict__` attribute for a module, class, instance,
+ or any other object with a :attr:`__dict__` attribute.
- With a module, class or class instance object as argument (or anything else that
- has a :attr:`__dict__` attribute), return that attribute.
+ Objects such as modules and instances have an updateable :attr:`__dict__`
+ attribute; however, other objects may have write restrictions on their
+ :attr:`__dict__` attributes (for example, new-style classes use a
+ dictproxy to prevent direct dictionary updates).
- .. note::
-
- The returned dictionary should not be modified:
- the effects on the corresponding symbol table are undefined. [#]_
+ Without an argument, :func:`vars` acts like :func:`locals`. Note, the
+ locals dictionary is only useful for reads since updates to the locals
+ dictionary are ignored.
.. function:: xrange([start,] stop[, step])
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list