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
863983e8
Kaydet (Commit)
863983e8
authored
Nis 23, 2003
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add comment on performance.
Fix missing right parenthesis. Add three examples.
üst
a69d409f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
3 deletions
+21
-3
libitertools.tex
Doc/lib/libitertools.tex
+21
-3
No files found.
Doc/lib/libitertools.tex
Dosyayı görüntüle @
863983e8
...
@@ -27,14 +27,21 @@ which produces a sequence \code{f(0), f(1), ...}. This toolbox
...
@@ -27,14 +27,21 @@ which produces a sequence \code{f(0), f(1), ...}. This toolbox
provides
\function
{
imap()
}
and
\function
{
count()
}
which can be combined
provides
\function
{
imap()
}
and
\function
{
count()
}
which can be combined
to form
\code
{
imap(f, count())
}
and produce an equivalent result.
to form
\code
{
imap(f, count())
}
and produce an equivalent result.
Likewise, the functional tools are designed to work well with the
high-speed functions provided by the
\refmodule
{
operator
}
module.
The module author welcomes suggestions for other basic building blocks
to be added to future versions of the module.
Whether cast in pure python form or C code, tools that use iterators
Whether cast in pure python form or C code, tools that use iterators
are more memory efficient (and faster) than their list based counterparts.
are more memory efficient (and faster) than their list based counterparts.
Adopting the principles of just-in-time manufacturing, they create
Adopting the principles of just-in-time manufacturing, they create
data when and where needed instead of consuming memory with the
data when and where needed instead of consuming memory with the
computer equivalent of ``inventory''.
computer equivalent of ``inventory''.
The module author welcomes suggestions for other basic building blocks
The performance advantage of iterators becomes more acute as the number
to be added to future versions of the module.
of elements increases -- at some point, lists grow large enough to
to severely impact memory cache performance and start running slowly.
\begin{seealso}
\begin{seealso}
\seetext
{
The Standard ML Basis Library,
\seetext
{
The Standard ML Basis Library,
...
@@ -105,7 +112,7 @@ by functions or loops that truncate the stream.
...
@@ -105,7 +112,7 @@ by functions or loops that truncate the stream.
Note, this is the only member of the toolkit that may require
Note, this is the only member of the toolkit that may require
significant auxiliary storage (depending on the length of the
significant auxiliary storage (depending on the length of the
iterable.
iterable
)
.
\end{funcdesc}
\end{funcdesc}
\begin{funcdesc}
{
dropwhile
}{
predicate, iterable
}
\begin{funcdesc}
{
dropwhile
}{
predicate, iterable
}
...
@@ -355,4 +362,15 @@ from building blocks.
...
@@ -355,4 +362,15 @@ from building blocks.
... "s
-
>
(
s
0
,s
1
)
,
(
s
1
,s
2
)
,
(
s
2
, s
3
)
, ..."
... "s
-
>
(
s
0
,s
1
)
,
(
s
1
,s
2
)
,
(
s
2
, s
3
)
, ..."
... return izip
(
seq, islice
(
seq,
1
,len
(
seq
)))
... return izip
(
seq, islice
(
seq,
1
,len
(
seq
)))
>>> def padnone
(
seq
)
:
... "Returns the sequence elements and then returns None indefinitely"
... return chain
(
seq, repeat
(
None
))
>>> def ncycles
(
seq, n
)
:
... "Returns the sequence elements n times"
... return chain
(*
repeat
(
seq, n
))
>>> def dotproduct
(
vec
1
, vec
2
)
:
... return sum
(
imap
(
operator.mul, vec
1
, vec
2
))
\end
{
verbatim
}
\end
{
verbatim
}
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