[Python-bugs-list] [ python-Bugs-645777 ] .extend() doc, .__doc__ too restrictive
noreply@sourceforge.net
noreply@sourceforge.net
Fri, 29 Nov 2002 09:42:35 -0800
Bugs item #645777, was opened at 2002-11-29 12:42
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=645777&group_id=5470
Category: Documentation
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Terry J. Reedy (tjreedy)
Assigned to: Nobody/Anonymous (nobody)
Summary: .extend() doc, .__doc__ too restrictive
Initial Comment:
LibRef 2.2.6.4 Mutable Sequence Types footnote (2)
(current version)to S.extend(x) says "Raises an
exception when x is not a list object." Similarly,
>>> a.extend.__doc__
'L.extend(list) -- extend list by appending list elements'
However, x need only be iterable. For instance (2.2.1)
>>> a.extend('ab')
>>> a
[1, 2, 3, 'a', 'b']
>> from __future__ import generators
>>> def f(n):
... for i in range(n): yield i
...
>>> a.extend(f(3))
>>> a
[1, 2, 3, 'a', 'b', 0, 1, 2]
Error message has already been updated:
>>> a.extend(1)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: list.extend() argument must be iterable
Question: footnote 2 also says "The extend() method
is experimental". Still true after two additional
releases, or time to delete this?
The continuation "and not supported by mutable
sequence types other than lists. " seems rather moot
(and delete-able) unless and until another m.s.t is
added.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=645777&group_id=5470