Can a function access its own name?

Fredrik Lundh fredrik at pythonware.com
Sun Nov 20 04:01:39 EST 2005


"B Mahoney" wrote:

> Decorate any function with @aboutme(), which
> will print the function name each time the function is called.
>
> All the 'hello' stuff is in the aboutme() decorator code.
> There is no code in the decorated functions themselves
> doing anything to telling us the function name.

so you've moved a trivial print statement from the function itself into
a decorator, so you can add an extra line before the function instead
of inside it.  wow.

</F>






More information about the Python-list mailing list