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
f4bb7f21
Kaydet (Commit)
f4bb7f21
authored
Şub 19, 2009
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add keyword arg support to itertools.repeat().
üst
15a4950d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
test_itertools.py
Lib/test/test_itertools.py
+1
-0
itertoolsmodule.c
Modules/itertoolsmodule.c
+6
-7
No files found.
Lib/test/test_itertools.py
Dosyayı görüntüle @
f4bb7f21
...
...
@@ -640,6 +640,7 @@ class TestBasicOps(unittest.TestCase):
self
.
assertNotEqual
(
len
(
set
(
map
(
id
,
list
(
product
(
'abc'
,
'def'
))))),
1
)
def
test_repeat
(
self
):
self
.
assertEqual
(
list
(
repeat
(
object
=
'a'
,
times
=
3
)),
[
'a'
,
'a'
,
'a'
])
self
.
assertEqual
(
lzip
(
range
(
3
),
repeat
(
'a'
)),
[(
0
,
'a'
),
(
1
,
'a'
),
(
2
,
'a'
)])
self
.
assertEqual
(
list
(
repeat
(
'a'
,
3
)),
[
'a'
,
'a'
,
'a'
])
...
...
Modules/itertoolsmodule.c
Dosyayı görüntüle @
f4bb7f21
...
...
@@ -3106,11 +3106,10 @@ repeat_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
repeatobject
*
ro
;
PyObject
*
element
;
Py_ssize_t
cnt
=
-
1
;
if
(
type
==
&
repeat_type
&&
!
_PyArg_NoKeywords
(
"repeat()"
,
kwds
))
return
NULL
;
if
(
!
PyArg_ParseTuple
(
args
,
"O|n:repeat"
,
&
element
,
&
cnt
))
static
char
*
kwargs
[]
=
{
"object"
,
"times"
,
NULL
};
if
(
!
PyArg_ParseTupleAndKeywords
(
args
,
kwds
,
"O|n:repeat"
,
kwargs
,
&
element
,
&
cnt
))
return
NULL
;
if
(
PyTuple_Size
(
args
)
==
2
&&
cnt
<
0
)
...
...
@@ -3178,8 +3177,8 @@ static PyMethodDef repeat_methods[] = {
};
PyDoc_STRVAR
(
repeat_doc
,
"repeat(
element [,times]) -> create an iterator which returns the elemen
t
\n
\
for the specified number of times. If not specified, returns the
elemen
t
\n
\
"repeat(
object [,times]) -> create an iterator which returns the objec
t
\n
\
for the specified number of times. If not specified, returns the
objec
t
\n
\
endlessly."
);
static
PyTypeObject
repeat_type
=
{
...
...
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