|  | Getting an objetcs dict? |  | |
| | | ssecorp |  |
| Posted: Mon Sep 01, 2008 6:31 pm Post subject: Getting an objetcs dict? |  |
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? |
| |
| | | Bruno Desthuilliers |  |
| Posted: Mon Sep 01, 2008 6:31 pm Post subject: Re: Getting an objetcs dict? |  |
ssecorp a écrit :
| Quote: | 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. |
| |
| | | Wojtek Walczak |  |
| Posted: Mon Sep 01, 2008 6:44 pm Post subject: Re: Getting an objetcs dict? |  |
On Mon, 1 Sep 2008 11:31:42 -0700 (PDT), ssecorp wrote:
| Quote: | 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?
|
You're not asking smart questions: LINK
HINT: the attribute you're accessing is not a callable.
-- Regards, Wojtek Walczak, LINK |
| |
| | | alex23 |  |
| Posted: Tue Sep 02, 2008 6:12 am Post subject: Re: Getting an objetcs dict? |  |
On Sep 2, 4:31 am, ssecorp <circularf...@gmail.com> wrote:
| Quote: | 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.
| Quote: | 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.
| Quote: | 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?
LINK |
| |
|
|