def hook?

Gerhard Häring haering_postgresql at gmx.de
Thu Nov 21 04:55:32 EST 2002


Roy Smith wrote in comp.lang.python:
> I'd like to have a bit of code run every time a function is defined.

I dont't think you can execute code upon function definition. But if
we're talking about methods, metaclasses could come in useful. They're
described at www.python.org -> Python 2.2 -> New style classes. (Damn,
where is "peek URL" in lynx?!).

-- Gerhard



More information about the Python-list mailing list