This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: bisect: implement aliases in Python, remove C aliases
Type: Stage:
Components: Versions: Python 3.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: larry, mdk, python-dev, rhettinger, serhiy.storchaka, vstinner, xiang.zhang
Priority: normal Keywords: patch

Created on 2016-11-24 21:07 by vstinner, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
bisect.patch vstinner, 2016-11-24 21:07 review
Messages (5)
msg281651 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-11-24 21:07
Attached patch simplifies the _bisect module: remove _bisect.bisect and _bisect.insort aliases. Aliases are created in Lib/

I wrote the patch to prepare the C code for Argument Clinic, see issue #28754.

Note: Lib/test/ already contains two unit tests:

    def test_backcompatibility(self):
        self.assertEqual(self.module.bisect, self.module.bisect_right)

    def test_backcompatibility(self):
        self.assertEqual(self.module.insort, self.module.insort_right)
msg281653 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2016-11-24 21:10
msg281659 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-11-24 21:48
Oh, bisect() was renamed to bisect_right() and insort() renamed to insort_right() in the changeset 67b3ac439f64 of Python 2.1. The aliases created for "backward compatibility" are for compatibility with... Python 2.0 :-)

The aliases were never deprecated. Maybe we can also remove/rephrase the "backward compatibility" comment.
msg281666 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-11-24 22:35
New changeset 45713818fd81 by Victor Stinner in branch 'default':
Issue #28792: Remove aliases from _bisect
msg281667 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-11-24 22:42
I pushed quickly my patch, so Julien can rebase his patch on top of that. I like his patch because it changes bisect to use FASTCALL which makes bisect faster!
Date User Action Args
2022-04-11 14:58:40adminsetgithub: 72978
2016-11-24 22:42:50vstinnersetstatus: open -> closed
resolution: fixed
2016-11-24 22:42:43vstinnersetmessages: + msg281667
2016-11-24 22:35:45python-devsetnosy: + python-dev
messages: + msg281666
2016-11-24 21:57:14vstinnersetnosy: + xiang.zhang
2016-11-24 21:57:01vstinnersetnosy: + serhiy.storchaka
2016-11-24 21:48:56vstinnersetmessages: + msg281659
2016-11-24 21:10:42mdksetmessages: + msg281653
2016-11-24 21:07:47vstinnercreate