__dict__ for instances?
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Sun May 13 09:40:39 EDT 2007
Ivan Voras a écrit :
> 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?
getattr(obj, name)
>
>>variables and values as a dictionary, but doesn't return methods.
>
>
> It does on a Class :(
>
Usually, methods are attributes of the class, not of the instance.
More information about the Python-list
mailing list