[Python-ideas] a sorting protocol dunder method?
Steven D'Aprano
steve at pearwood.info
Mon Dec 4 07:25:57 EST 2017
On Mon, Dec 04, 2017 at 08:45:55AM +0200, Serhiy Storchaka wrote:
> But the idea of the class decorator looks more sane to me.
The purpose of __key__ is to define a key function (not a comparison
operator) for classes that aren't orderable and don't have __lt__.
If you're going to then go ahead and define __lt__ and the other
comparison operators, there's no point to __key__.
--
Steve
More information about the Python-ideas
mailing list