peter wrote:
brain reset and understood
thx a lot for all your answers
Peter
Now that you've got reset, you might want to consider an alternative solution:
def fA(input):
return input
oldfA = fA # Hold a reference to the the old function
def newFA(input):
"Do something new"
return oldfA
peter wrote:
Hello, nice solution:
but it puzzles me :)
can anyone tell me why
---correct solution
def fA(input):
return input
def newFA(input, f= fA):
return f(input)
This saves a reference to the original function in the new function's
default argument.
brain reset and understood
thx a lot for all your answers
Peter
--
http://mail.python.org/mailman/listinfo/python-list
"peter" <[EMAIL PROTECTED]> wrote
>
> PYTHON-CODE # REMARKS
> referenceA = SomeObject() # referenceA -> SomeObject()
> # references to the memory space of
>
peter wrote:
Hello, nice solution:
but it puzzles me :)
can anyone tell me why
---correct solution
def fA(input):
return input
def newFA(input, f= fA):
return f(input)
fA = newFA
is correct and:
-infinite loop-
def fA(input):
return input
d
peter wrote:
Hello, nice solution:
but it puzzles me :)
can anyone tell me why
---correct solution
def fA(input):
return input
def newFA(input, f= fA):
return f(input)
fA = newFA
is correct and:
>>> def fA(input):
... print "inside fA"
... return input
...
>>>
Hello, nice solution:
but it puzzles me :)
can anyone tell me why
---correct solution
def fA(input):
return input
def newFA(input, f= fA):
return f(input)
fA = newFA
is correct and:
-infinite loop-
def fA(input):
return input
def newF
Op 2005-02-16, peter schreef <[EMAIL PROTECTED]>:
> Hello all,
>
> Recently I've started to refactor my code ...(I'm using python 2.3.4)
> I tried to add extra functionality to old functions non-intrusively.
> When I used a construct, which involves renaming functions etc... I
> came across some re
see the topic:
adding new functionality to a function non-intrusively! and decorators
if you want to add functionality to a function!
--
http://mail.python.org/mailman/listinfo/python-list