Metaclasses vs. standard Python reflection?
Stephan Diehl
stephan.diehl at gmx.net
Sat May 3 06:18:22 EDT 2003
Jeremy Fincher wrote:
> I've been looking for examples of metaclasses I can use for a talk I'm
> going to be giving next week, but I've been having trouble finding
> examples that solve problems that wouldn't just as easily be via
> Python's uber-reflective __getattr__/__setattr__ and inheritance.
> Does anyone have a good example of a problem that's solved more
> "beautifully" with metaclasses than with Python's standard reflection
> facilities?
>
> Thanks,
> Jeremy
I've just added some tiny, little meta-class example to the python cookbook
(http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/197965).
Actually, I had started to look into meta-class programming after this
thread was started. I found Alex's Python in a Nutshell and Ians SQLObject
source most valuable so far in understanding meta-classes.
It might be a good idea to post more examples in the python cookbook. I've
kindly requested to have a category "meta-classes" added to the cookbook.
Stephan
More information about the Python-list
mailing list