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
c800af41
Kaydet (Commit)
c800af41
authored
Nis 04, 2011
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update timeit to use the new string formatting syntax.
üst
f7ec1698
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
timeit.py
Lib/timeit.py
+4
-4
No files found.
Lib/timeit.py
Dosyayı görüntüle @
c800af41
...
...
@@ -79,10 +79,10 @@ else:
# being indented 8 spaces.
template
=
"""
def inner(_it, _timer):
%(setup)
s
{setup}
_t0 = _timer()
for _i in _it:
%(stmt)
s
{stmt}
_t1 = _timer()
return _t1 - _t0
"""
...
...
@@ -126,9 +126,9 @@ class Timer:
stmt
=
reindent
(
stmt
,
8
)
if
isinstance
(
setup
,
str
):
setup
=
reindent
(
setup
,
4
)
src
=
template
%
{
'stmt'
:
stmt
,
'setup'
:
setup
}
src
=
template
.
format
(
stmt
=
stmt
,
setup
=
setup
)
elif
hasattr
(
setup
,
'__call__'
):
src
=
template
%
{
'stmt'
:
stmt
,
'setup'
:
'_setup()'
}
src
=
template
.
format
(
stmt
=
stmt
,
setup
=
'_setup()'
)
ns
[
'_setup'
]
=
setup
else
:
raise
ValueError
(
"setup is neither a string nor callable"
)
...
...
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