Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
32e2ff5d
Kaydet (Commit)
32e2ff5d
authored
Mar 04, 2013
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge
üst
6c2078d5
f2c17a92
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
functools.py
Lib/functools.py
+11
-7
No files found.
Lib/functools.py
Dosyayı görüntüle @
32e2ff5d
...
...
@@ -291,19 +291,23 @@ def lru_cache(maxsize=128, typed=False):
# computed result and update the count of misses.
pass
elif
full
:
# use root to store the new key and result
root
[
KEY
]
=
key
root
[
RESULT
]
=
result
cache
[
key
]
=
roo
t
# use
the old
root to store the new key and result
oldroot
=
root
oldroot
[
KEY
]
=
key
oldroot
[
RESULT
]
=
resul
t
# empty the oldest link and make it the new root
root
=
root
[
NEXT
]
del
cache
[
root
[
KEY
]]
root
=
oldroot
[
NEXT
]
oldkey
=
root
[
KEY
]
oldvalue
=
root
[
RESULT
]
root
[
KEY
]
=
root
[
RESULT
]
=
None
# now update the cache dictionary for the new links
del
cache
[
oldkey
]
cache
[
key
]
=
oldroot
else
:
# put result in a new link at the front of the queue
last
=
root
[
PREV
]
link
=
[
last
,
root
,
key
,
result
]
cache
[
key
]
=
last
[
NEXT
]
=
root
[
PREV
]
=
link
last
[
NEXT
]
=
root
[
PREV
]
=
cache
[
key
]
=
link
full
=
(
len
(
cache
)
==
maxsize
)
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