[issue9314] inconsistent result when concatenating list with iterators

2010-07-21 Thread Ray.Allen
Ray.Allen ysj@gmail.com added the comment: Alexander: When a is mutable, a += b updates it in-place, so there is no ambiguity: the type of a cannot change. When you do a + b, there is no reason to treat a as more deserving than b when selecting the type of the result Does this means

[issue9314] inconsistent result when concatenating list with iterators

2010-07-21 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: On Wed, Jul 21, 2010 at 2:09 AM, Ray.Allen rep...@bugs.python.org wrote: .. Does this means a += b is not the same as a = a + b? For immutable a, the two are practically the same, for mutable, they are necessarily

[issue9314] inconsistent result when concatenating list with iterators

2010-07-21 Thread Alexander Belopolsky
Changes by Alexander Belopolsky belopol...@users.sourceforge.net: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9314 ___

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Dirkjan Ochtman
New submission from Dirkjan Ochtman dirk...@ochtman.nl: This seems wrong: a = [] b = iter(['c', 'd']) a += b c = [] c + iter(['d', 'e']) Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate list (not listiterator) to list In other words, if

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +merwok ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9314 ___ ___ Python-bugs-list mailing

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: This actually works for any iterator: l = [] l += 'abc' l ['a', 'b', 'c'] -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9314

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc amaur...@gmail.com added the comment: for any *iterable*! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9314 ___ ___

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: In other words, if iadd can deal with it, why can't add? Should ['a', 'b', 'c'] + 'def' return ['a, 'b', 'c', 'd' , 'e', 'f'] or 'abcdef'? In the face of ambiguity, refuse the temptation to guess. -- nosy:

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Dirkjan Ochtman
Dirkjan Ochtman dirk...@ochtman.nl added the comment: Sure, but: a = ['a', 'b', 'c'] a += 'def' a ['a', 'b', 'c', 'd', 'e', 'f'] I think either way is fine (I'm probably on the side of refusing to guess), but what I don't understand is why a += b is different from a + b in this respect.

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I don't understand is why a += b is different from a + b in this respect. When a is mutable, a += b updates it in-place, so there is no ambiguity: the type of a cannot change. When you do a + b, there is no reason to

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Alexander Belopolsky
Changes by Alexander Belopolsky belopol...@users.sourceforge.net: -- type: - feature request versions: +Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9314 ___

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: Note that immutable types are consistent: x = tuple('abc') x += 'def' Traceback (most recent call last): File stdin, line 1, in module TypeError: can only concatenate tuple (not str) to tuple x + 'def' Traceback

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Dirkjan Ochtman
Dirkjan Ochtman dirk...@ochtman.nl added the comment: Hmm, that's pretty subtle. I guess I understand, at least. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9314 ___

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Alexander Belopolsky
Changes by Alexander Belopolsky belopol...@users.sourceforge.net: -- assignee: - belopolsky resolution: - rejected stage: - committed/rejected status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9314

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Alexander, why the pending status? Dirkjan, do you think this is a doc bug? -- status: pending - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9314

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9314 ___ ___ Python-bugs-list

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: why the pending status? To me this is a way to say I will close this next time I look unless someone will change my mind. pending has a nice property that it will change to open once someone adds a comment. This is

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Thanks for the explanation of pending, I thought the mysterious Roundup/browser bug had changed the status in my back. Searching for __iadd__ gave me only library/collections; library/stdtypes says very little. I thought it was common to

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Alexander Belopolsky
Alexander Belopolsky belopol...@users.sourceforge.net added the comment: I thought it was common to requalify a bug report into a doc bug. That's upto you and OP. My rule of thumb is if the title reads as either code or doc bug, it's ok to reclassify. If not, it is better to open a separate

[issue9314] inconsistent result when concatenating list with iterators

2010-07-20 Thread Dirkjan Ochtman
Dirkjan Ochtman dirk...@ochtman.nl added the comment: Hmm, I'm still not entirely sure that += shouldn't disallow this as well, just because of the inconsistency. I understand the reasoning now, but it feels like maybe it should be an implementation detail, and it should just be disallowed