Try to address this in a larger context than decimal. The same sort of logic is present in sets.py and in datetime objects.
Interesting. In that case, my other suggestion was to have raising NotImplementedError from a special method be the equivalent of returning NotImplemented (which makes life much easier for a class like Decimal which has an internal method for doing the type conversion).
Then a class ("NotImplementedTypeError"?) that inherited from both NotImplementedError and TypeError could be used to fix the problem in a fairly backward compatible way - the PyNumber machinery would see the NotImplemented error, and try the other available operators before falling back to generating its own TypeError, while direct calls with invalid arguments would still be raising a subclass of TypeError, so existing code to catch TypeError from direct calls would continue to function.
I didn't suggest this initially, since I didn't realise Decimal wasn't the only class with the problem, and I'm sure messing with PyNumber_* isn't possible for the 2.4 series :)
Cheers, Nick.
-- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.skystorm.net _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com