Metaclasses vs. standard Python reflection?
Aahz
aahz at pythoncraft.com
Fri May 2 15:39:34 EDT 2003
In article <mailman.1051865104.23607.python-list at python.org>,
Jack Diederich <jack at performancedrivers.com> wrote:
>
>The original question could have been:
>
>What can you do with while or for loops that you can't do with if and
>goto?
>
>metaclasses are like that while or for loop, you can work around their
>absence but it is nice not to have to. metaclasses make some hard
>things easier and less error prone. There are a number of ways to get
>the same effect, but none as tidy. Other languages solve the same
>problem with code generation tools[1] . metaclasses just make python a
>little cleaner and clearer if you need to do something unusual.
Note the emphasis on "hard things". while/for are low-level coding
abstractions; classes and packages are medium-level coding abstractions,
and metaclasses are a high-level coding abstraction. Metaclasses
require a lot of effort to "get" before one can really start making use
of them.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"In many ways, it's a dull language, borrowing solid old concepts from
many other languages & styles: boring syntax, unsurprising semantics,
few automatic coercions, etc etc. But that's one of the things I like
about it." --Tim Peters on Python, 16 Sep 93
More information about the Python-list
mailing list