Inspect Python Classes for instance data information

George Sakkis gsakkis at rutgers.edu
Mon May 2 21:24:28 EDT 2005


> > I have no idea how to do the inspection part of this little
> > problem. I could just have each class define its own meathod to
> > convert to this format, but that would be a lot of work when i
> > could just make one class that solves the problem for all classes.
> > Is there a way to do this?
>
> Check out the gnosis.magic package of David Mertz (
>
http://www-106.ibm.com/develop­erworks/linux/library/l-pymeta­.html).

> Even if it's not exactly what you want, it will give you an idea of
> where to go from there

..or if you'd rather avoid metaclasses and start from scratch, this
article is a nice guideline to introspection:
http://www-106.ibm.com/developerworks/library/l-pyint.html

George




More information about the Python-list mailing list