Hi

I'm trying to understand why it is that I can do

>>> a = []
>>> a += 'stuff'
>>> a
['s', 't', 'u', 'f', 'f']

but not

>>> a = []
>>> a = a + 'stuff'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can only concatenate list (not "str") to list

Can someone explain the logic? Why is the in-place add not a type
error but the usual add is? (This applies to both Python 2.6rc1 and
3.0b2)

Thanks
Roman
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to