Getting an objetcs dict?

alex23 wuwei23 at gmail.com
Tue Sep 2 02:12:44 EDT 2008


On Sep 2, 4:31 am, ssecorp <circularf... at gmail.com> wrote:
> X.__dict__() and ngot a dict of its variables.
>
> Now i get errors doing this. what am i doing wrong?

The immediate problem is you're not reading the error messages.

>>> X.__dict__()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'dict' object is not callable

The "not callable" is the big tip-off. As it states, __dict__ is a
dictionary object, -not- a method of your class.

>>> X.__dict__
{'__module__': '__main__', '__doc__': None}

The larger problem is you're not reading the docs & are using this
list to teach you Python. Are you aware of the python-tutor list?

http://mail.python.org/mailman/listinfo/tutor




More information about the Python-list mailing list