Kaydet (Commit) 1af03e98 authored tarafından Tim Peters's avatar Tim Peters

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.
üst 442914d2
...@@ -100,7 +100,8 @@ Core ...@@ -100,7 +100,8 @@ Core
map(), filter(), reduce(), zip() map(), filter(), reduce(), zip()
list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API) list(), tuple() (PySequence_Tuple() and PySequence_Fast() in C API)
max(), min() max(), min()
.join() method of strings join() method of strings
extend() method of lists
'x in y' and 'x not in y' (PySequence_Contains() in C API) 'x in y' and 'x not in y' (PySequence_Contains() in C API)
operator.countOf() (PySequence_Count() in C API) operator.countOf() (PySequence_Count() in C API)
......
...@@ -644,7 +644,7 @@ listextend_internal(PyListObject *self, PyObject *b) ...@@ -644,7 +644,7 @@ listextend_internal(PyListObject *self, PyObject *b)
static PyObject * static PyObject *
list_inplace_concat(PyListObject *self, PyObject *other) list_inplace_concat(PyListObject *self, PyObject *other)
{ {
other = PySequence_Fast(other, "argument to += must be a sequence"); other = PySequence_Fast(other, "argument to += must be iterable");
if (!other) if (!other)
return NULL; return NULL;
...@@ -664,7 +664,7 @@ listextend(PyListObject *self, PyObject *args) ...@@ -664,7 +664,7 @@ listextend(PyListObject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "O:extend", &b)) if (!PyArg_ParseTuple(args, "O:extend", &b))
return NULL; return NULL;
b = PySequence_Fast(b, "list.extend() argument must be a sequence"); b = PySequence_Fast(b, "list.extend() argument must be iterable");
if (!b) if (!b)
return NULL; return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment