Function/method returning list of chars in string?
Diez B. Roggisch
deets at nospam.web.de
Tue Jun 9 06:05:14 EDT 2009
Hendrik van Rooyen wrote:
> "Diez B. Roggisch" <d..s at nam.web.de> wrote:
>
>>
>> I think
>>
>> lb = list(s)
>>
>> is good enough.
>
> It does the job, of course, but it is not a string method.
And that is a bad thing because of what?
Also as list-comps are going away and are replaced by
list(<generator-expression>)
I'd say it's much more consistent when faced with the task of creating a
list of anything that's iterable one uses the
list(<iterable>)
idiom.
Diez
More information about the Python-list
mailing list