[ python-Bugs-1641109 ] 2.3.6.4 Error in append and extend descriptions

SourceForge.net noreply at sourceforge.net
Mon Jan 22 09:20:03 CET 2007


Bugs item #1641109, was opened at 2007-01-21 23:34
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1641109&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: ilalopoulos (arafin)
Assigned to: Nobody/Anonymous (nobody)
Summary: 2.3.6.4 Error in append and extend descriptions

Initial Comment:
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)

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2007-01-22 08:20

Message:
Logged In: YES 
user_id=849994
Originator: NO

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.)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1641109&group_id=5470


More information about the Python-bugs-list mailing list