To: Steven D'Aprano
From: [email protected] (Stefan Ram)
Steven D'Aprano <[email protected]> writes:
>def f():
> static x = 0
> def g():
> x += 1
> return x
> return g
What one can do today:
main.py
def g():
g.x += 1
return g.x
g.x = 0
print( g() )
print( g() )
print( g() )
transcript
1
2
3
main.py
def f():
def g():
g.x += 1
return g.x
g.x = 0
return g
g = f()
print( g() )
print( g() )
print( g() )
transcript
1
2
3
--- BBBS/Li6 v4.10 Toy-3
* Origin: Prism bbs (1:261/38)
--
https://mail.python.org/mailman/listinfo/python-list