[Python-ideas] Tweaking closures and lexical scoping to include the function being defined
Steven D'Aprano
steve at pearwood.info
Mon Sep 26 17:55:46 CEST 2011
Yuval Greenfield wrote:
> I just want to chime in with how static variables can be bad for multi
> threaded code, yet they aren't considered as bad as global variables. E.g.
> the find_path guido example will explode if called by 2 threads in tandem. I
> believe this is more apparent and frowned upon when caused by global
> variables.
Are you saying that Guido's find_path example is thread-safe when
written with the default argument hack, but will fail with the new proposal?
> Hasn't python given enough temptations to avoid multithreading already?
One can never have enough reasons to avoid multi-threading! <wink>
But seriously, unless this proposal makes things *worse*, I don't see
why this is an objection.
> Allowing these fast, local, persistent static variables is like allowing
> braces instead of whitespace - the good coders will manage either way but
> the bad will do bad things with it.
That's an analogy that makes no sense to me.
--
Steven
More information about the Python-ideas
mailing list