[Python-ideas] Optional key to `bisect`'s functions?
masklinn at masklinn.net
Thu Feb 9 09:53:48 CET 2012
On 2012-02-09, at 03:42 , Terry Reedy wrote:
> On 2/8/2012 5:18 PM, Amaury Forgeot d'Arc wrote:
>> This was proposed several times on the issue tracker (search for "bisect
>> and these proposals have always been rejected:
> Do these all suggest a specific api and if so, do they agree?
Suggests a ``key=`` argument behaving as with ``sorted`` and
``list.sort``: collection values are decorated with the key before
comparisons. This is exactly my original email.
Suggests a ``cmp=`` argument (proposal precedes Python 3 and ``key=``
taking over) to use instead of the built-in comparison operator.
Suggests all of ``cmp=`` (this again being opposed in ``cmp=`` having
been dropped from Python 3), ``key=`` and ``reverse=``.
In summary, all three suggest following the existing API of
``list.sort`` and ``sorted``, and at least implementing its ``key=``
argument (I am taking issue1451588 as doing so, since it suggests the
mechanism and argument which preceded ``key``)
More information about the Python-ideas