Pythonic way to do static local variables?
Nicolas Fleury
nid_oizo at yahoo.com_removethe_
Tue Apr 26 00:08:07 EDT 2005
Charles Krug wrote:
> I've a function that needs to maintain an ordered sequence between
> calls.
>
> In C or C++, I'd declare the pointer (or collection object) static at
> the function scope.
>
> What's the Pythonic way to do this?
>
> Is there a better solution than putting the sequence at module scope?
>
> Thanks.
You might want a generator. Search for yield keyword.
Regards,
Nicolas
More information about the Python-list
mailing list