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
21315ba9
Kaydet (Commit)
21315ba9
authored
Şub 23, 2009
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update itertools recipes to use next().
üst
6d327b0d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
itertools.rst
Doc/library/itertools.rst
+3
-4
No files found.
Doc/library/itertools.rst
Dosyayı görüntüle @
21315ba9
...
@@ -326,14 +326,14 @@ loops that truncate the stream.
...
@@ -326,14 +326,14 @@ loops that truncate the stream.
return self
return self
def __next__(self):
def __next__(self):
while self.currkey == self.tgtkey:
while self.currkey == self.tgtkey:
self.currvalue = next(self.it) # Exit on StopIteration
self.currvalue = next(self.it)
# Exit on StopIteration
self.currkey = self.keyfunc(self.currvalue)
self.currkey = self.keyfunc(self.currvalue)
self.tgtkey = self.currkey
self.tgtkey = self.currkey
return (self.currkey, self._grouper(self.tgtkey))
return (self.currkey, self._grouper(self.tgtkey))
def _grouper(self, tgtkey):
def _grouper(self, tgtkey):
while self.currkey == tgtkey:
while self.currkey == tgtkey:
yield self.currvalue
yield self.currvalue
self.currvalue = next(self.it) # Exit on StopIteration
self.currvalue = next(self.it)
# Exit on StopIteration
self.currkey = self.keyfunc(self.currvalue)
self.currkey = self.keyfunc(self.currvalue)
...
@@ -652,8 +652,7 @@ which incur interpreter overhead.
...
@@ -652,8 +652,7 @@ which incur interpreter overhead.
def pairwise(iterable):
def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = tee(iterable)
a, b = tee(iterable)
for elem in b:
next(b, None)
break
return zip(a, b)
return zip(a, b)
def grouper(n, iterable, fillvalue=None):
def grouper(n, iterable, fillvalue=None):
...
...
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