Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
9db492f1
Commit
9db492f1
authored
May 14, 2002
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consistently use a single leading underscore for instance variable
names.
parent
769fad63
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
lib/python/Products/ZCTextIndex/NBest.py
lib/python/Products/ZCTextIndex/NBest.py
+7
-7
No files found.
lib/python/Products/ZCTextIndex/NBest.py
View file @
9db492f1
...
...
@@ -35,11 +35,11 @@ class NBest:
# This does a very simple thing with sorted lists. For large
# N, a min-heap can be unboundedly better in terms of data
# movement time.
self
.
scores
=
[]
self
.
items
=
[]
self
.
_
scores
=
[]
self
.
_
items
=
[]
def
__len__
(
self
):
return
len
(
self
.
scores
)
return
len
(
self
.
_
scores
)
def
capacity
(
self
):
return
self
.
_capacity
...
...
@@ -48,7 +48,7 @@ class NBest:
self
.
addmany
([(
item
,
score
)])
def
addmany
(
self
,
sequence
):
scores
,
items
,
capacity
=
self
.
scores
,
self
.
items
,
self
.
_capacity
scores
,
items
,
capacity
=
self
.
_scores
,
self
.
_
items
,
self
.
_capacity
n
=
len
(
scores
)
for
item
,
score
in
sequence
:
# When we're in steady-state, the usual case is that we're filled
...
...
@@ -66,11 +66,11 @@ class NBest:
assert
n
==
len
(
scores
)
def
getbest
(
self
):
result
=
zip
(
self
.
items
,
self
.
scores
)
result
=
zip
(
self
.
_items
,
self
.
_
scores
)
result
.
reverse
()
return
result
def
pop_smallest
(
self
):
if
self
.
scores
:
return
self
.
items
.
pop
(
0
),
self
.
scores
.
pop
(
0
)
if
self
.
_
scores
:
return
self
.
_items
.
pop
(
0
),
self
.
_
scores
.
pop
(
0
)
raise
IndexError
(
"pop_smallest() called on empty NBest object"
)
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