On Mar 28, 9:17 am, Michele Simionato
wrote:
> Another option is to use my own decorator module (http://
> pypi.python.org/pypi/decorator):
>
> from decorator import decorator
>
> @decorator
> def d(func, *args):
> print 3
> return func(*args)
>
> @d
> def f(a, b):
> print a + b
>
> f(
Another option is to use my own decorator module (http://
pypi.python.org/pypi/decorator):
from decorator import decorator
@decorator
def d(func, *args):
print 3
return func(*args)
@d
def f(a, b):
print a + b
f(5, 7)
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 27, 11:24 am, vsoler wrote:
> I see what happened. The first line was somehow hidden.
> Thank you very much.
You're welcome. Sorry about the formatting. Also, note that if your
decorator is complicated, you might want to use a class instead of a
nested function. Here's the same thing, u
On 27 mar, 17:21, vsoler wrote:
> On 27 mar, 17:06, Patrick Maupin wrote:
>
>
>
> > On Mar 27, 10:24 am, vsoler wrote:
>
> > > Hi,
>
> > > Still learning Python, now decorators.
>
> > > Before diving deeply into decorators, I'd like to apply a function to
> > > another function.
>
> > > My "extr
On 27 mar, 17:06, Patrick Maupin wrote:
> On Mar 27, 10:24 am, vsoler wrote:
>
>
>
> > Hi,
>
> > Still learning Python, now decorators.
>
> > Before diving deeply into decorators, I'd like to apply a function to
> > another function.
>
> > My "extremely simple function" should print number 3, the
On Mar 27, 10:24 am, vsoler wrote:
> Hi,
>
> Still learning Python, now decorators.
>
> Before diving deeply into decorators, I'd like to apply a function to
> another function.
>
> My "extremely simple function" should print number 3, then the sum of
> its 2 arguments.
>
> Say that I call f(5,7
Hi,
Still learning Python, now decorators.
Before diving deeply into decorators, I'd like to apply a function to
another function.
My "extremely simple function" should print number 3, then the sum of
its 2 arguments.
Say that I call f(5,7)
I'd like to get, somehow, 3 then 12.
I've tried the