On 12/03/2016 18:07, Marko Rauhamaa wrote:
BartC <b...@freeuk.com>:
No it's very easy. In Python terms:
def f(): return "One"
def g(): return "Two"
h=f
h() returns "One". Later you do h=g, and h() returns "Two". No need
for f and g themselves to be dynamic. h just needs to be a variable.
Well, what do you make of this:
>>> def f(): return 1
...
>>> g = f
>>> def f(): return 2
...
>>> g()
1
>>> f()
2
def f001(): return 1
f = f001
g = f
def f002(): return 2
f=f002;
print(g())
print(f())
Same results, but now we've agains removed the need for the function
names (f001 and f002) to be mutable.
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list