Tim's latest, with some of my changes (also a TP suggestion) added:
instead of testing whether the list changed size after each
comparison, temporarily set the type of the list to an immutable list
type.  This should allow continued use of the list for legitimate
purposes but disallows all operations that can change it in any way.
(Changes to the internals of list items are not caught, of cause;
that's not possible to detect, and it's not necessary to protect the
sort code, either.)
1 file changed