Josh Rosenberg added the comment:

Note: index returns without the caller having a chance to execute code that 
would change the sequence length directly. But other threads could change it, 
as could a custom __eq__ on an object stored in the sequence (or a poorly 
implemented __getitem__ or __len__ on the sequence itself, but that's getting 
even more pathological). Thread consistency is the code's responsibility though 
(we just need to make sure we behave the best we can, and hope they use locks 
correctly), and the odds of equality of __getitem__ altering the sequence are 
much lower than the odds of someone iterating the sequence and changing it as 
they go (which is what __iter__'s implementation allows, responding with 
potentially incomplete results since items might be skipped due to the 
mutation), but keeping the sequence in a consistent state.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23086>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to