Metaclasses vs. standard Python reflection?

Lulu of the Lotus-Eaters mertz at gnosis.cx
Wed May 7 12:42:13 EDT 2003


Pedro Rodriguez <pedro_rodriguez at club-internet.fr> wrote previously:
|> In particular, look at the function import_with_metaclass()

|But as far as my understanding of AOP goes, I am not comfortable with
|the usage of metaclasses for this purpose. For instance, your function
|will alter all classes of an imported module, where I expect an "aspect"
|to be precisely targeted at some functions (I don't think it will be
|difficult to specialize your function for this purpose).

My understanding of AspectJ is that it picks classes to "aspectify"
based simply on naming conventions (i.e. a regex or glob type pattern to
match the relevant classes).  It would be extremely easy to make
import_with_metaclass() do exactly this (maybe with a default "pat='*'"
argument; I'd prefer to settle for glob patterns, but it's up to you).

Yours, Lulu...

--
Keeping medicines from the bloodstreams of the sick; food from the bellies
of the hungry; books from the hands of the uneducated; technology from the
underdeveloped; and putting advocates of freedom in prisons.  Intellectual
property is to the 21st century what the slave trade was to the 16th.





More information about the Python-list mailing list