[Python-3000] sort vs order (was: What should the focus for 2.6 be?) (original) (raw)

Jim Jewett jimjjewett at gmail.com
Thu Aug 24 18:37:35 CEST 2006


On 8/24/06, Guido van Rossum <guido at python.org> wrote:

Another change that is unlikely to be available in 2.x is the rationalization of comparisons. In 3.0, "1 < 'abc'" will raise a TypeError; there's just no way to backport this behavior, since again it requires pervasive changes to the implementation.

I still believe that this breaks an important current use case for sorting, but maybe the right answer is a different (but similar) API.

Given an arbitrary collection of objects, I want to be able to order them in a consistent manner, at least within a single interpreter session. (Consistency across sessions/machines/persistence/etc would be even better, but isn't essential.)

The current sort method works pretty well; the new one wouldn't. It would be enough (and arguably an improvement, because of broken objects) if there were a consistent_order equivalent that just caught the TypeError and then tried a fallback for you until it found an answer.

-jJ



More information about the Python-3000 mailing list