Is this a bug?

ajikoe at gmail.com ajikoe at gmail.com
Sun Apr 24 11:38:57 EDT 2005


when you use a = a + 'world'  python sees it as an error because of
different type.

But when you use a += 'world'
python will change the right into list (because a is a list). So when
you're code become:
a += 'world' # a += list('world')

It really helpfull if you stick to use append instead of += when you
operate list

Pujo




More information about the Python-list mailing list