like a "for loop" for a string

MRAB google at mrabarnett.plus.com
Sun Aug 17 18:05:45 EDT 2008


On Aug 17, 8:40 pm, bearophileH... at lycos.com wrote:
> Eric Wertman:
>
> > So what exactly does that do?  Returns a generator, instead of a list?
>
> Allows you to iterate on the parts in a lazy way, without creating the
> whole list of the pieces.
> The arguments are the same of str.split().
>
If it was introduced into Python v3.x then wouldn't it have to be
called str.split in order to be consistent with xrange -> range? :-)



More information about the Python-list mailing list