[ python-Bugs-848812 ] Inconsistent list.__add__/__addi__.

SourceForge.net noreply at sourceforge.net
Sat Nov 29 03:44:09 EST 2003


Bugs item #848812, was opened at 2003-11-25 04:50
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=848812&group_id=5470

Category: None
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Jeremy Fincher (jemfinch)
Assigned to: Nobody/Anonymous (nobody)
Summary: Inconsistent list.__add__/__addi__.

Initial Comment:
>>> L = [1,2,3] 
>>> L + (1,2,3) 
Traceback (most recent call last): 
  File "<stdin>", line 1, in ? 
TypeError: can only concatenate list (not "tuple") to list 
>>> L += (1,2,3) 
>>> L 
[1, 2, 3, 1, 2, 3] 
 
I've always been somewhat annoyed that list.__add__ 
didn't accept any iterable (just lists), but to have += accept 
any iterable but not + is just plain inconsistent. 

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

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-11-29 03:44

Message:
Logged In: YES 
user_id=80475

It's a feature, not a bug.  The goal is to eliminate
unattractive, error prone constructions.  Probe the archives
for past discussion and pronouncement on this.  

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

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



More information about the Python-bugs-list mailing list