Static variables

Gary Herron gherron at islandtraining.com
Wed Jan 24 16:12:35 EST 2007


Florian Lindner wrote:
> Hello,
> does python have static variables? I mean function-local variables that keep
> their state between invocations of the function.
>
> Thanks,
>
> Florian
>   
Nope.  Not really.

In new versions of Python, functions and methods can have attributes 
that can be used like function level static variables. 

However, I usually use module level attributes for such things.

Gary Herron




More information about the Python-list mailing list