Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Python

Getting an objetcs dict?

 
Jump to:  
 
ssecorp
PostPosted: 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
PostPosted: 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
PostPosted: 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
PostPosted: 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
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

przeprowadzki kraków apteka zabawki edukacyjne turystyka lokata