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
11485b48
Kaydet (Commit)
11485b48
authored
Şub 04, 2009
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Minor doc fixes.
üst
1e884d9f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
glossary.rst
Doc/glossary.rst
+1
-1
itertools.rst
Doc/library/itertools.rst
+3
-3
test_itertools.py
Lib/test/test_itertools.py
+6
-3
No files found.
Doc/glossary.rst
Dosyayı görüntüle @
11485b48
...
@@ -396,7 +396,7 @@ Glossary
...
@@ -396,7 +396,7 @@ Glossary
also :term:`immutable`.
also :term:`immutable`.
named tuple
named tuple
Any tuple
sub
class whose indexable elements are also accessible using
Any tuple
-like
class whose indexable elements are also accessible using
named attributes (for example, :func:`time.localtime` returns a
named attributes (for example, :func:`time.localtime` returns a
tuple-like object where the *year* is accessible either with an
tuple-like object where the *year* is accessible either with an
index such as ``t[0]`` or with a named attribute like ``t.tm_year``).
index such as ``t[0]`` or with a named attribute like ``t.tm_year``).
...
...
Doc/library/itertools.rst
Dosyayı görüntüle @
11485b48
...
@@ -221,7 +221,7 @@ loops that truncate the stream.
...
@@ -221,7 +221,7 @@ loops that truncate the stream.
class groupby(object):
class groupby(object):
# [k for k, g in groupby('AAAABBBCCDAABBB')] --> A B C D A B
# [k for k, g in groupby('AAAABBBCCDAABBB')] --> A B C D A B
# [
(list(g)
) for k, g in groupby('AAAABBBCCD')] --> AAAA BBB CC D
# [
list(g
) for k, g in groupby('AAAABBBCCD')] --> AAAA BBB CC D
def __init__(self, iterable, key=None):
def __init__(self, iterable, key=None):
if key is None:
if key is None:
key = lambda x: x
key = lambda x: x
...
@@ -614,8 +614,8 @@ which incur interpreter overhead.
...
@@ -614,8 +614,8 @@ which incur interpreter overhead.
return imap(function, count(start))
return imap(function, count(start))
def nth(iterable, n):
def nth(iterable, n):
"Returns the nth item or
empty list
"
"Returns the nth item or
None
"
return
list(islice(iterable, n, n+1)
)
return
next(islice(iterable, n, None), None
)
def quantify(iterable, pred=bool):
def quantify(iterable, pred=bool):
"Count how many times the predicate is true"
"Count how many times the predicate is true"
...
...
Lib/test/test_itertools.py
Dosyayı görüntüle @
11485b48
...
@@ -1201,8 +1201,8 @@ Samuele
...
@@ -1201,8 +1201,8 @@ Samuele
... return imap(function, count(start))
... return imap(function, count(start))
>>> def nth(iterable, n):
>>> def nth(iterable, n):
... "Returns the nth item or
empty list
"
... "Returns the nth item or
None
"
... return
list(islice(iterable, n, n+1)
)
... return
next(islice(iterable, n, None), None
)
>>> def quantify(iterable, pred=bool):
>>> def quantify(iterable, pred=bool):
... "Count how many times the predicate is true"
... "Count how many times the predicate is true"
...
@@ -1318,7 +1318,10 @@ perform as purported.
...
@@ -1318,7 +1318,10 @@ perform as purported.
[0, 2, 4, 6]
[0, 2, 4, 6]
>>> nth('abcde', 3)
>>> nth('abcde', 3)
['d']
'd'
>>> nth('abcde', 9) is None
True
>>> quantify(xrange(99), lambda x: x
%2
==0)
>>> quantify(xrange(99), lambda x: x
%2
==0)
50
50
...
...
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