Newbie: anything resembling static?

John Roth johnroth at ameritech.net
Wed Jan 29 16:28:35 EST 2003


"anton wilson" <anton.wilson at camotion.com> wrote in message
news:mailman.1043870531.24472.python-list at python.org...
>
> Is there any way of imitating "static" C function variables without
having to
> define the variable as a global? I just want persistent function
variables
> but i want them to be local to the function namespace. :S
>
>
>
> Anton

Not obviously. The two ways of doing something similar are:

1. Use a class; the class instance will keep persistant variables

2. Use a simple generator. All of the function's variables
are persistant across calls to the generator.

HTH.

John Roth
>






More information about the Python-list mailing list