[Python-Dev] Re: timsort?

Skip Montanaro skip@pobox.com
Wed, 4 Jun 2003 09:09:52 -0500


    Gareth> Sure, but the old and new ways require all that code only so
    Gareth> that they can be very fast. Why not switch to a simpler but
    Gareth> slower sort (say, a simple implementation of quicksort) instead
    Gareth> of giving a MemoryError?

Once a malloc or realloc call fails there's no telling if you can recover.
You might be able to guarantee that if it ran to completion your simple
implementation of quicksort consumes less memory than timsort, but you don't
know that it will succeed.  It's better to punt.

Skip