Class introspection and dynamically determining function arguments

Diez B. Roggisch deetsNOSPAM at web.de
Fri Jan 21 06:45:47 EST 2005


> The classes I'm dealing with do have attributes since they're
> C-Extension types with attributes provided in the "tp_getset" slot. So
> this is one case where I can query the class for attributes without
> having to create an instance. Thanks for making me think of that, since
> looking in the class's __dict__ pretty much gives me what I want. I'm
> not sure that that's something I can rely on though which is exactly the
> sort of issue where I'd like to know if there's a right way (e.g. an
> existing module) to ask a class for its attributes, without poking
> around in __dict__ directly and doing some type checking. I guess in a
> way I'm asking for introspection with a greater degree of granularity
> than "dir".

According to this
http://www-106.ibm.com/developerworks/library/l-pyint.html

not really - and there are no special moduls neccessary, as everything is at
your hands using __dict__ and so on.


-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list