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
c6897854
Commit
c6897854
authored
Mar 31, 2012
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix-up a comment
parent
7f7a5a7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
3 deletions
+2
-3
Lib/functools.py
Lib/functools.py
+2
-3
No files found.
Lib/functools.py
View file @
c6897854
...
...
@@ -172,7 +172,7 @@ def lru_cache(maxsize=100, typed=False):
cache
=
{}
hits
=
misses
=
0
kwd_mark
=
(
object
(),)
# separate positional and keyword args
cache_get
=
cache
.
get
# bound method to lookup key or return None
cache_get
=
cache
.
get
# bound method to lookup
a
key or return None
sentinel
=
object
()
# unique object used with cache_get
_len
=
len
# localize the global len() function
lock
=
Lock
()
# because linkedlist updates aren't threadsafe
...
...
@@ -250,8 +250,7 @@ def lru_cache(maxsize=100, typed=False):
# empty the oldest link and make it the new root
root
=
root
[
NEXT
]
del
cache
[
root
[
KEY
]]
root
[
KEY
]
=
None
root
[
RESULT
]
=
None
root
[
KEY
]
=
root
[
RESULT
]
=
None
misses
+=
1
return
result
...
...
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