summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2012-01-06 07:23:52 (GMT)
committerRaymond Hettinger <python@rcn.com>2012-01-06 07:23:52 (GMT)
commit36cdca1277f799a111c8d439d86426c229b9d239 (patch)
tree9204587e39853c64083bbbef9f5b9faab12a294b
parent24f207e99e8ec2213fffde44d6d637b1a9770944 (diff)
downloadcpython-36cdca1277f799a111c8d439d86426c229b9d239.zip
cpython-36cdca1277f799a111c8d439d86426c229b9d239.tar.gz
cpython-36cdca1277f799a111c8d439d86426c229b9d239.tar.bz2
Clarify that vars() doesn't place extra restrictions on __dict__.
-rw-r--r--Doc/library/functions.rst16
1 files changed, 9 insertions, 7 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 69f5d64..991093e 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -1447,15 +1447,17 @@ available. They are listed here in alphabetical order.
.. 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])