vars()

Built-in FunctionPython 2.0+Intermediate

Returns the __dict__ attribute of an object

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y

p = Point(1, 2)
print(vars(p))

vars() is a built-in function that returns the __dict__ attribute of an object.

Try in Playground

Tags

builtinfunctioncoreintrospectionoop

Related Items