How can I programmatically find the name of a method from within that method?

Peter Otten __peter__ at web.de
Wed Aug 8 03:25:20 EDT 2007


kj7ny wrote:

> What is @checkPrivs (see example copied below from other post)?  In
> fact... how does the thing work at all? 

> @checkPrivs
> def add(a,b):
>     return a+b

@... is called a decorator and is just a fancy way of writing

def add(a, b):
    return a+b
add = checkPrivs(add)

Peter



More information about the Python-list mailing list