Bug or feature?

Markus Reitz Markus_Reitz at yahoo.com
Wed Mar 21 06:44:09 EST 2001


Hi,

I'm using Python 2.0 and have found a, according to my opinion, strange
behaviour.

a=[]
a.extend('Test')

Printing a results in:

a=['T','e','s','t']

I expected a TypeError message, because a String is not a list and so it
can't be used to extend an existing list.

On the other hand, a string can be seen as a kind of "list of characters"
...

Is this behaviour a bug or a feature?

Markus





More information about the Python-list mailing list