SPAM-LOW: Re: Function/method returning list of chars in string?

Marco Mariani marco at
Tue Jun 9 06:06:12 EDT 2009

Hendrik van Rooyen wrote:

>> lb = list("banana")
> Aaargh!
> I should have known - you use a string method to get a list of words,
> but you have to go to the list to get a list of characters from a string.

As they say, "Python is not Java".

Strings support the sequence protocol (aka interface), hence they can be 
given as input to the list constructor.

It would not make much sense to add methods (to the N concrete 
implementations, mind you) that replicate functionality available by the 
builtin constructors through implicit interfaces.

Would you also ask for '43'.as_int() or stuff like that?

More information about the Python-list mailing list