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.

classification
Title: 2.3.6.4 Error in append and extend descriptions
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: arafin, georg.brandl
Priority: normal Keywords:

Created on 2007-01-21 23:34 by arafin, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg31071 - (view) Author: arafin (arafin) Date: 2007-01-21 23:34
2.3.6.4 Mutable Sequence Types (2.4.4 Python Doc) 

Error in the table describing append and extend operations for the list type.

specificaly:

s.append(x) same as s[len(s):len(s)] = [x] (2) 
s.extend(x) same as s[len(s):len(s)] = x (3) 

should be:

s.append(x) same as s[len(s):len(s)] = x (2) 
s.extend(x) same as s[len(s):len(s)] = [x] (3)
msg31072 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-01-22 08:20
Have you tried the original code and your corrections?
If you do, you'll find that the original is correct.

(In extend, x is already a sequence, so you mustn't wrap it in a list.
In append, you want only one element added, so you wrap x in a list.)
History
Date User Action Args
2022-04-11 14:56:22adminsetgithub: 44492
2007-01-21 23:34:30arafincreate