
Sept. 22, 2014
7:28 p.m.
On Mon, Sep 22, 2014 at 12:19 PM, David Wilson <dw+python-ideas@hmmz.org> wrote:
Another concern is structures that rely on comparison could become performance hazards as they are mixed with user subclasses that perform nontrivial work in their __lt__ methods, and suchlike. That's a potentially undesirable trait for a built-in type.
I don't get this objection. If a user-defined subclass has slow comparisons then the container containing it becomes slow. You can't blame that on the (fast) base class nor on the container type. The same applies to ==: if I write a str subclass that overrides __eq__ with a slower version than dict lookups become slower. The solution is simple: don't do that. -- --Guido van Rossum (python.org/~guido)