__dict__ for instances?

Ivan Voras ivoras at __fer.hr__
Sun May 13 07:30:37 EDT 2007


half.italian at gmail.com wrote:

> I think you want "dir(instance)"  __dict__ returns the instance

Part of the problem is that dir(instance) returns a list of strings, so
iterating the dir(instance) gets me strings, not methods. Alternatively,
is there a way to get a "bound" instance by its name - some
introspection function perhaps?

> variables and values as a dictionary, but doesn't return methods.

It does on a Class :(

-- 
(\__/)
(O.o)
(> < )

This is Bunny.
Copy Bunny into your signature to help him on his way to world domination!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20070513/7e9a60a5/attachment.sig>


More information about the Python-list mailing list