static statements and thread safety

E

Eric Snow

A recent thread on the python-ideas list got me thinking about the
possibility of a static statement (akin to global and nonlocal). I am
wondering if an implementation would have to address thread safety
concerns.

I would expect that static variables would work pretty much the same
way as default arguments, with a list of names on the code object and
a list of values on the function object. And I would guess that the
values from the static variables would get updated on the function
object at the end of the call. If multiple threads are executing the
function at the same time won't there be a problem with that
end-of-call update?

-eric


p.s. It probably shows that I haven't done a lot of thread-related
programming, so perhaps this is not a hard question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top