Functionality like local static in C

Cecil Westerhof Cecil at decebal.nl
Fri Apr 15 06:18:18 EDT 2022


Thanks for the multiple answers. I was pleasantly surprised.
I have something to think about. :-D

In principle I selected a solution for the problem for which I asked
it, but I first have to finish some other stuff. I hope to find time
to implement it next week.

Everyone a good weekend and Eastern.

Cecil Westerhof <Cecil at decebal.nl> writes:
> In C when you declare a variable static in a function, the variable
> retains its value between function calls.
> The first time the function is called it has the default value (0 for
> an int).
> But when the function changes the value in a call (for example to 43),
> the next time the function is called the variable does not have the
> default value, but the value it had when the function returned.
> Does python has something like that?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the Python-list mailing list