module dict python

Solutions on MaxInterview for module dict python by the best coders in the world

showing results for - "module dict python"
Louanne
23 Jun 2018
1class MyClass(object):
2    class_var = 1
3
4    def __init__(self, i_var):
5        self.i_var = i_var
6
7foo = MyClass(2)
8bar = MyClass(3)
9
10print MyClass.__dict__
11print foo.__dict__
12print bar.__dict__
Jonas
10 Jan 2018
1{'__module__': '__main__', 'class_var': 1, '__dict__': <attribute '__dict__' of 'MyClass' objects>, '__weakref__': <attribute '__weakref__' of 'MyClass' objects>, '__doc__': None, '__init__': <function __init__ at 0x0000000004E55CF8>}
2{'i_var': 2}
3{'i_var': 3}
4
5