[Python-ideas] Fwd: Concurrent safety?
Paul Moore
p.f.moore at gmail.com
Tue Nov 1 17:36:36 CET 2011
On 1 November 2011 15:38, Mike Meyer <mwm at mired.org> wrote:
> No, the proposal does make things "safe by default". The default behavior
> disallows all mutation. You have to do something explicit to allow it -
> because "explicit is better than implicit."
[...]
> Um, yeah, I did point out later in the paragraph that preserving pythons
> data types may make this assumption false.
[...]
> And I also pointed out that this may be to much of a change to be palatable
> to Python users. For that matter, if it requires losing pythons primitive
> container types, it's probably to much of a change to be palatable to me.
I don't know if you've considered this already, but a for-loop in
Python creates an iterator and then mutates it (by calling next()) on
each run through the loop. I can't see any way this could be a
concurrency problem in itself, but you'd likely need to either
reimplement the for loop to avoid relying on mutable iterators, or
you'd need to add some sort of exclusion for iterators in for loops.
It'll be details like this that will be the hardest to thrash out, I suspect...
Paul.
More information about the Python-ideas
mailing list