Diez B. Roggisch wrote:
> However I've encountered one peculiarity that strikes me odd:
>
> When one writes a decorated function like this:
>
> @decorate
> def foo():
>pass
>
> the function decorate usually looks like this:
>
> def decorate(func):
>def _d(*args, **kwargs):
>do_some
Hi
> Clear now? there is no extra indirection. If you call something on
> the @ line, the _result_of_that_call_ should be a decorator function.
> If you use my curry recipe in the python cookbook, you can use curry
> lower the apparent "indirection":
Ok - that makes it clear, thanks.
--
Regard
Diez B. Roggisch wrote:
def decorate(func):
def _d(*args, **kwargs):
do_something()
# call func
func(*args, **kwargs)
return _d
@decorate
def foo():
pass
[T]he function decorator has to return a function that is bound to the na
Hi,
I just wrote my first decorator example - and I already love them.
However I've encountered one peculiarity that strikes me odd:
When one writes a decorated function like this:
@decorate
def foo():
pass
the function decorate usually looks like this:
def decorate(func):
def _d(*ar