GZ wrote:
Hi All,
I am looking at the following code:
def fn():
def inner(x):
return tbl[x]
tbl={1:'A', 2:'B'}
f1 = inner # I want to make a frozen copy of the values of tbl
in f1
tbl={1:'C', 2:'D'}
f2 = inner
return (f1,f2)
f1,f2 = fn()
f1(1) # output C
f2
On Wed, Apr 28, 2010 at 1:31 AM, GZ wrote:
> I am looking at the following code:
>
> def fn():
>
> def inner(x):
> return tbl[x]
>
> tbl={1:'A', 2:'B'}
> f1 = inner # I want to make a frozen copy of the values of tbl
> in f1
> tbl={1:'C', 2:'D'}
> f2 = inner
> return (f1
Hi All,
I am looking at the following code:
def fn():
def inner(x):
return tbl[x]
tbl={1:'A', 2:'B'}
f1 = inner # I want to make a frozen copy of the values of tbl
in f1
tbl={1:'C', 2:'D'}
f2 = inner
return (f1,f2)
f1,f2 = fn()
f1(1) # output C
f2(1) # output