diff options
author | Raymond Hettinger <python@rcn.com> | 2013-06-02 17:03:05 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2013-06-02 17:03:05 (GMT) |
commit | d71001749dfb97db677c7720f53f4a8df56dcf63 (patch) | |
tree | 27e6c3cd1bc869c8bdda409d520d3259a4feb201 | |
parent | dcdadfe39afd9b7cddf1e20efa37babdad61ff77 (diff) | |
download | cpython-d71001749dfb97db677c7720f53f4a8df56dcf63.zip cpython-d71001749dfb97db677c7720f53f4a8df56dcf63.tar.gz cpython-d71001749dfb97db677c7720f53f4a8df56dcf63.tar.bz2 |
Clarify which dictionaries are updateable
by using the wording from the Py2.7 docs.
-rw-r--r-- | Doc/library/functions.rst | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index c82e03f..3059e17 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1355,14 +1355,18 @@ are always 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, classes use a + dictproxy to prevent direct dictionary updates). + + 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. - .. note:: - The returned dictionary should not be modified: - the effects on the corresponding symbol table are undefined. [#]_ .. function:: zip(*iterables) @@ -1481,7 +1485,3 @@ are always available. They are listed here in alphabetical order. .. [#] Note that the parser only accepts the Unix-style end of line convention. If you are reading the code from a file, make sure to use newline conversion mode to convert Windows or Mac-style newlines. - -.. [#] In the current implementation, local variable bindings cannot normally be - affected this way, but variables retrieved from other scopes (such as modules) - can be. This may change. |