This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: .extend() doc, .__doc__ too restrictive
Type: Stage:
Components: Documentation Versions: Python 2.2
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: rhettinger, terry.reedy
Priority: normal Keywords:

Created on 2002-11-29 17:42 by terry.reedy, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (2)
msg13492 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2002-11-29 17:42
LibRef 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 
msg13493 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2002-12-29 06:00
Logged In: YES 


See listobject.c revision: 2.143 and
and libstdtypes.tex revision: 1.115 and

Closing bug.
Date User Action Args
2022-04-10 16:05:57adminsetgithub: 37553
2002-11-29 17:42:35terry.reedycreate