__init__
で定義された変数がクラスからアクセスできないのはなぜですか? 外部からアクセスできるように、インスタンス化中に実行する必要がありますか?
>>> class a:
... data = {}
...
>>> a.data
{}
>>> class a:
... def __init__(self):
... self.data = {}
...
>>> a.data
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: class a has no attribute 'data'