mirror of https://github.com/python/cpython
Clarify that vars() doesn't place extra restrictions on __dict__.
This commit is contained in:
parent
24f207e99e
commit
36cdca1277
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue