Newbie: anything resembling static?
Mongryong
Mongryong at sympatico.ca
Sat Feb 1 16:27:32 EST 2003
On Sat, 2003-02-01 at 16:05, Tom wrote:
>
> > def five():
> > staticvar = []
> > def innerfive():
> > staticvar.append('x')
> > return ''.join(staticvar)
> > return innerfive
> > five = five()
>
> one question: after I've called the function 'five' several times, is
> there a way to see the current value of 'staticvar' in an interactive
> session?
>
def outer():
static = []
def inner():
static.append('x')
return ''.join(static)
return inner, static
>>> f, s = outer()
>>> f()
'x'
>>> f()
'xx'
>>> s
['x', 'x']
More information about the Python-list
mailing list