“модуль .__ dict__ python” Ответ

модуль .__ dict__ python

class MyClass(object):
    class_var = 1

    def __init__(self, i_var):
        self.i_var = i_var

foo = MyClass(2)
bar = MyClass(3)

print MyClass.__dict__
print foo.__dict__
print bar.__dict__
Horrible Hawk

модуль .__ dict__ python

{'__module__': '__main__', 'class_var': 1, '__dict__': <attribute '__dict__' of 'MyClass' objects>, '__weakref__': <attribute '__weakref__' of 'MyClass' objects>, '__doc__': None, '__init__': <function __init__ at 0x0000000004E55CF8>}
{'i_var': 2}
{'i_var': 3}

Horrible Hawk

Ответы похожие на “модуль .__ dict__ python”

Вопросы похожие на “модуль .__ dict__ python”

Больше похожих ответов на “модуль .__ dict__ python” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования