Michael Broe wrote:
> I just discovered the following behavior, but can't find any  
> documentation about it:
> 
>  >>> list = []
>  >>> list = list + 'abc'
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
> TypeError: can only concatenate list (not "str") to list
> 
> but:
> 
>  >>> list = []
>  >>> list += 'abc'
>  >>> list
> ['a', 'b', 'c']

There was a recent thread on c.l.py that started with exactly this 
question. The consensus seems to be that it is a mistake but oh well.
http://groups.google.com/group/comp.lang.python/browse_frm/thread/c96f9830c6919354/94cab5c3b99a9ffa?tvc=1#94cab5c3b99a9ffa

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to