I read that vars()
is a built-in that returns the __dict__
attribute of class, module or object. But when I checked for vars(Person) is Person.__dict__
, it returned False
(Person
is the name of class).
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
vars(Person) is Person.__dict__ # False
Classes create a new mappingproxy on every __dict__
access. You would see the exact same results from Person.__dict__ is Person.__dict__
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With