Hi,

On Tue, Dec 13, 2011 at 11:37, Amaury Forgeot d'Arc <amaur...@gmail.com> wrote:
>> "When sorting a list using the sort() method, attempting to inspect or
>> mutate the content of the list will result in undefined behaviour."
>
> (...)
> So behaviour is not undefined at all...

No, the behavior _is_ undefined.  The comment you cited says that it
cannot crash the Python interpreter; additionally, it makes a
best-effort attempt at catching such accesses and raising ValueError.
But I think I can build a strange-looking example where you mutate a
list during sorting and don't get a ValueError (although admittedly it
needs a lot of hacking to do that nowadays, e.g. multiple threads).


A bientôt,

Armin.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to