Range Operation pre-PEP
Magnus Lie Hetland
mlh at idi.ntnu.no
Tue May 15 18:08:43 EDT 2001
"Just van Rossum" <just at letterror.com> wrote in message
> Magnus Lie Hetland wrote:
>
> > Is sys.stdin going to be a line iterator? Why?
>
> Convenience?
>
> for line in file:
> ...
>
> I think that's pretty awesome. And once you see it, it makes you
> wonder why it hasn't always worked like that...
>
I guess so. I remember making the suggestion of
for line in file.lines:
...
and
for char in file.chars:
...
I see that lines are used in the PEP (and the CVS version),
and I guess it's a very reasonable default.
for line in sys.stdin:
...
seems like a very Pythonesque way of spelling the
abhorrent
while (<>) {
...
}
:)
> Just
--
Magnus Lie Hetland http://www.hetland.org
"Reality is that which, when you stop believing in
it, doesn't go away." -- Philip K. Dick
More information about the Python-list
mailing list