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
8158e849
Commit
8158e849
authored
Sep 06, 2004
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix erroneous docstring comment.
parent
7d3755d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
Doc/lib/libheapq.tex
Doc/lib/libheapq.tex
+3
-2
Lib/heapq.py
Lib/heapq.py
+3
-2
Modules/_heapqmodule.c
Modules/_heapqmodule.c
+3
-2
No files found.
Doc/lib/libheapq.tex
View file @
8158e849
...
...
@@ -60,9 +60,10 @@ This is more efficient than \function{heappop()} followed
by
\function
{
heappush()
}
, and can be more appropriate when using
a fixed-size heap. Note that the value returned may be larger
than
\var
{
item
}
! That constrains reasonable uses of this routine
unless written as part of a
larger expression
:
unless written as part of a
conditional replacement
:
\begin{verbatim}
result = item <= heap[0] and item or heapreplace(heap, item)
if item > heap[0]:
item = heapreplace(heap, item)
\end{verbatim}
\end{funcdesc}
...
...
Lib/heapq.py
View file @
8158e849
...
...
@@ -154,9 +154,10 @@ def heapreplace(heap, item):
This is more efficient than heappop() followed by heappush(), and can be
more appropriate when using a fixed-size heap. Note that the value
returned may be larger than item! That constrains reasonable uses of
this routine unless written as part of a
larger expression
:
this routine unless written as part of a
conditional replacement
:
result = item <= heap[0] and item or heapreplace(heap, item)
if item > heap[0]:
item = heapreplace(heap, item)
"""
returnitem
=
heap
[
0
]
# raises appropriate IndexError if heap is empty
heap
[
0
]
=
item
...
...
Modules/_heapqmodule.c
View file @
8158e849
...
...
@@ -186,8 +186,9 @@ PyDoc_STRVAR(heapreplace_doc,
This is more efficient than heappop() followed by heappush(), and can be
\n
\
more appropriate when using a fixed-size heap. Note that the value
\n
\
returned may be larger than item! That constrains reasonable uses of
\n
\
this routine unless written as part of a larger expression:
\n\n
\
result = item <= heap[0] and item or heapreplace(heap, item)
\n
"
);
this routine unless written as part of a conditional replacement:
\n\n
\
if item > heap[0]:
\n
\
item = heapreplace(heap, item)
\n
"
);
static
PyObject
*
heapify
(
PyObject
*
self
,
PyObject
*
heap
)
...
...
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