Steven D'Aprano wrote:
>
> The reason I ask is because I've just spent the weekend battling with
> doctests of decorated functions, and discovering that without
> functools.wraps() all my doctests weren't being called. I'm wondering
> whether it would be a good idea for doctest to auto-detect tes
Steven D'Aprano wrote:
> Suppose I have a function f() which I know has been decorated, but I don't
> have access to the original undecorated function any longer:
>
> def reverse(func):
> def f(*args):
> args = list(args)
> args.reverse()
> return func(*args)
> ret
Hrvoje Niksic wrote:
>> Is there any way to peek inside the decorated function rsay() to get
>> access to the undecorated function say()?
>
> This works in Python 2.5.2:
>
rsay.func_closure[0].cell_contents
>
Thanks to everyone who responded.
The reason I ask is because I've just spent
On Feb 15, 4:27 am, Hrvoje Niksic wrote:
> Steven D'Aprano writes:
> > Suppose I have a function f() which I know has been decorated, but I don't
> > have access to the original undecorated function any longer:
>
> > def reverse(func):
> > def f(*args):
> > args = list(args)
> >
Steven D'Aprano writes:
> Suppose I have a function f() which I know has been decorated, but I don't
> have access to the original undecorated function any longer:
>
> def reverse(func):
> def f(*args):
> args = list(args)
> args.reverse()
> return func(*args)
> re
Steven D'Aprano wrote:
> Suppose I have a function f() which I know has been decorated, but I don't
> have access to the original undecorated function any longer:
>
> def reverse(func):
> def f(*args):
> args = list(args)
> args.reverse()
> return func(*args)
> ret
Steven D'Aprano wrote:
Suppose I have a function f() which I know has been decorated, but I don't
have access to the original undecorated function any longer:
def reverse(func):
def f(*args):
args = list(args)
args.reverse()
return func(*args)
return f
def say(*a
Suppose I have a function f() which I know has been decorated, but I don't
have access to the original undecorated function any longer:
def reverse(func):
def f(*args):
args = list(args)
args.reverse()
return func(*args)
return f
def say(*args):
print args
rsa