To: Stefan Ram From: [email protected] (Stefan Ram) [email protected] (Stefan Ram) writes: >def f(): > def g(): > g.x += 1 > return g.x > g.x = 0 > return g
Or, "for all g to share the same x":
main.py
def f():
def g():
f.x += 1
return f.x
return g
f.x = 0
g = f()
print( g() )
print( g() )
print( g() )
g1 = f()
print( g1() )
print( g1() )
print( g1() )
transcript
1
2
3
4
5
6
--- BBBS/Li6 v4.10 Toy-3
* Origin: Prism bbs (1:261/38)
--
https://mail.python.org/mailman/listinfo/python-list
