PEP318: radical notion
Arien Malec
arien_malec at yahoo.com.REMOVE
Wed Aug 25 13:26:17 EDT 2004
Michael Sparks <michaels at rd.bbc.co.uk> wrote in
news:cgi4vh$4q7$1 at nntp0.reith.bbc.co.uk:
> Arien Malec wrote:
> ...
>> Is there a valid use case that supports arbitrary magical
>> non-metadata transformations of standalone functions?
>
> 2 use cases (in addition to others people have mentioned) I can think
> of off the top of my head:
> * Adding call tracing to specific functions without disturbing the
> code.
> * Wrapping generator functions so that they can recieve data in an
> IPC manner.
PEP318 = AOP by another name?
I can think of a couple of workaround for the issue you raise:
1) Allow a "module metaclass" -- something that can intercept function
defs at a module level, read metadata, and apply necessary
transformations
2) Have a default class that standalone functions are static members of,
which can have a default metaclass associated with it.
I personally think that separating metadata from transformations is a
much cleaner approach than using the transformation implementation for
everything.
Arien
More information about the Python-list
mailing list