Range Operation pre-PEP

Neil Schemenauer nas at python.ca
Wed May 16 10:01:23 EDT 2001


Magnus Lie Hetland wrote:
> I guess so. I remember making the suggestion of
> 
>   for line in file.lines:
>       ...
> 
> and
> 
>   for char in file.chars:
>       ...

That probably should be:

    for line in file.lines():
        ...

    for line in file.chars():
        ...

Those calls should return an iterator object.

  Neil




More information about the Python-list mailing list