Paul Rubin wrote:
I don't see that big a problem.  The current Python sorting routine
operates on instances of class "object" and calls the __cmp__ method
to do comparisons.  Every class of sortable objects either defines a
__cmp__ method or inherits one from some superclass, and sort calls
those methods.  Static type declarations would not require writing any
additional sorting routines.

Python's list.sort doesn't check the *type* of the arguments at all. It only looks for the relevant comparison methods (__cmp__ or __lt__, as I recall).


Sure, classes written in *Python* will ultimately inherit from either object or types.ClassType, but extension classes need not do any such thing.

Yet list.sort works with them all, anyway.

Cheers,
Nick.

--
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---------------------------------------------------------------
            http://boredomandlaziness.skystorm.net
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to