On Tue, Nov 1, 2011 at 9:36 AM, Paul Moore <span dir="ltr"><<a href="mailto:p.f.moore@gmail.com">p.f.moore@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
On 1 November 2011 15:38, Mike Meyer <<a href="mailto:mwm@mired.org">mwm@mired.org</a>> wrote:<br>
> No, the proposal does make things "safe by default". The default behavior<br>
> disallows all mutation. You have to do something explicit to allow it -<br>
> because "explicit is better than implicit."<br>
[...]<br>
> Um, yeah, I did point out later in the paragraph that preserving pythons<br>
> data types may make this assumption false.<br>
[...]<br>
> And I also pointed out that this may be to much of a change to be palatable<br>
> to Python users. For that matter, if it requires losing pythons primitive<br>
> container types, it's probably to much of a change to be palatable to me.<br>
<br>
I don't know if you've considered this already, but a for-loop in<br>
Python creates an iterator and then mutates it (by calling next()) on<br>
each run through the loop. I can't see any way this could be a<br>
concurrency problem in itself, but you'd likely need to either<br>
reimplement the for loop to avoid relying on mutable iterators, or<br>
you'd need to add some sort of exclusion for iterators in for loops.</blockquote><div><br></div><div>How about a third option? Iterators have to be locked to do a next in general, as they can be bound and thus shared between execution threads. On the other hand, locking & unlocking should be the major performance hit, so you don't want to do that on something that's going to be happening a lot, so the caller should be allowed to do something to indicate that it's not required. Locking the iterator should do that. So the next method needs to add a test to see if self is locked, and if not lock and then unlock self.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
It'll be details like this that will be the hardest to thrash out, I suspect...</blockquote><div><br></div><div>Yup.</div><div><br></div><div> Thanks,</div><div> <mike </div></div>