Getting an objetcs dict?

  • Thread starter Bruno Desthuilliers
  • Start date
B

Bruno Desthuilliers

ssecorp a écrit :
I did nce (I think).
class X

X.__dict__() and ngot a dict of its variables.
Now i get errors doing this. what am i doing wrong?

cf Wojtek's answer.
 
S

ssecorp

I did nce(I think).

class X

X.__dict__() and ngot a dict of its variables.

Now i get errors doing this. what am i doing wrong?
 
A

alex23

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.
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.
{'__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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top