Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
96be3400
Commit
96be3400
authored
Apr 08, 2019
by
Chillar Anand
Committed by
Inada Naoki
Apr 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove duplicate code in biscet (GH-1270)
parent
b7eec94c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
16 deletions
+2
-16
Lib/bisect.py
Lib/bisect.py
+2
-16
No files found.
Lib/bisect.py
View file @
96be3400
...
...
@@ -9,14 +9,7 @@ def insort_right(a, x, lo=0, hi=None):
slice of a to be searched.
"""
if
lo
<
0
:
raise
ValueError
(
'lo must be non-negative'
)
if
hi
is
None
:
hi
=
len
(
a
)
while
lo
<
hi
:
mid
=
(
lo
+
hi
)
//
2
if
x
<
a
[
mid
]:
hi
=
mid
else
:
lo
=
mid
+
1
lo
=
bisect_right
(
a
,
x
,
lo
,
hi
)
a
.
insert
(
lo
,
x
)
def
bisect_right
(
a
,
x
,
lo
=
0
,
hi
=
None
):
...
...
@@ -49,14 +42,7 @@ def insort_left(a, x, lo=0, hi=None):
slice of a to be searched.
"""
if
lo
<
0
:
raise
ValueError
(
'lo must be non-negative'
)
if
hi
is
None
:
hi
=
len
(
a
)
while
lo
<
hi
:
mid
=
(
lo
+
hi
)
//
2
if
a
[
mid
]
<
x
:
lo
=
mid
+
1
else
:
hi
=
mid
lo
=
bisect_left
(
a
,
x
,
lo
,
hi
)
a
.
insert
(
lo
,
x
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment