C
Chance Ginger
If I define a decorator like:
def t(x) :
def I(x) : return x
return I
and use it like:
@t(X)
def foo(a) :
# definition of foo...
pass
or maybe this:
@t(X)
@(Y)
def bar(a) :
# The definition of bar...
Will in encounter much of a penalty in executing
'foo' or 'bar'? If so, is there a way to define
t such that Python knows it is the identity function
and short-circuit evaluation?
Thanks in advance.
def t(x) :
def I(x) : return x
return I
and use it like:
@t(X)
def foo(a) :
# definition of foo...
pass
or maybe this:
@t(X)
@(Y)
def bar(a) :
# The definition of bar...
Will in encounter much of a penalty in executing
'foo' or 'bar'? If so, is there a way to define
t such that Python knows it is the identity function
and short-circuit evaluation?
Thanks in advance.