Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1af03e9

Browse files
committed
Change list.extend() error msgs and NEWS to reflect that list.extend()
now takes any iterable argument, not only sequences. NEEDS DOC CHANGES -- but I don't think we settled on a concise way to say this stuff.
1 parent 442914d commit 1af03e9

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ Core
100100
map(), filter(), reduce(), zip()
101101
list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API)
102102
max(), min()
103-
.join() method of strings
103+
join() method of strings
104+
extend() method of lists
104105
'x in y' and 'x not in y' (PySequence_Contains() in C API)
105106
operator.countOf() (PySequence_Count() in C API)
106107

Objects/listobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ listextend_internal(PyListObject *self, PyObject *b)
644644
static PyObject *
645645
list_inplace_concat(PyListObject *self, PyObject *other)
646646
{
647-
other = PySequence_Fast(other, "argument to += must be a sequence");
647+
other = PySequence_Fast(other, "argument to += must be iterable");
648648
if (!other)
649649
return NULL;
650650

@@ -664,7 +664,7 @@ listextend(PyListObject *self, PyObject *args)
664664
if (!PyArg_ParseTuple(args, "O:extend", &b))
665665
return NULL;
666666

667-
b = PySequence_Fast(b, "list.extend() argument must be a sequence");
667+
b = PySequence_Fast(b, "list.extend() argument must be iterable");
668668
if (!b)
669669
return NULL;
670670

0 commit comments

Comments
 (0)