Name

vars

Synopsis

vars([obj])

When called with no argument, vars( ) returns a dictionary that represents all variables that are bound in the current scope (exactly like locals, covered in this section). This dictionary should be treated as read-only. vars( obj ) returns a dictionary that represents all attributes currently bound in obj, as covered in dir in this section. This dictionary may or may not be modifiable, depending on the type of obj.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.