You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
typing should have a single-method protocol for__lt__ #728
That protocol is already defined ad hoc in statistics.pyi, to solve a couple of cases there, but it can also be used in builtins.pyi for max(), min()sorted(), list.sort() or any other function that depends on sorting items to do its job.
For many user-defined functions that use one of these functions internally, a protocol like _Sortable is needed to provide accurate type hints. That's the case of statistics.median_high and median_low: the use cases that prompted the definition of _Sortable in statistics.pyi.
I'm not sure what its name should be. A few options:
Sortable is OK by me.
PEP 484 has an example ABC named Comparable that defines __lt__—but the text suggests the other comparison operators would be part of that ABC.
typing has a bunch of SupportsXyz protocols, so maybe SupportsLessThan?
changed the title [-]`typing` should include a single-method protocol for`__lt__`[/-][+]`typing` should have a single-method protocol for`__lt__`[/+]on May 28, 2020
See also python/typeshed#4131 for a suggestion to add such protocols to typeshed for now and then possibly transferring them to typing if they prove to be used.
Activity
[-]`typing` should include a single-method protocol for`__lt__`[/-][+]`typing` should have a single-method protocol for`__lt__`[/+]srittau commentedon May 28, 2020
See also python/typeshed#4131 for a suggestion to add such protocols to typeshed for now and then possibly transferring them to typing if they prove to be used.
gvanrossum commentedon Jun 21, 2020
This should probably be an issue (and preferably a PR) for typeshed.