repeat/while?
Steve Holden
sholden at holdenweb.com
Thu May 3 16:08:49 EDT 2001
"Russell Nelson" <nelson at crynwr.com> wrote ...
> Is there any enthusiasm for repeat/while in Python? It would replace the
following ideom:
>
No :-)
Note that in version 2.2, if iterators are implemented, such a construct
would be unnecessary. But there have been a lot of recent threads suggesting
looping variations, and I haven't (yet) seen a proposal that attracted
everyone's approval. There are good reasons why most of them won't fly.
Do a Google search on "do until Python" and see if you agree.
regards
Steve
> while 1:
> line = sys.stdin.readline()
> if not line: break
> pass # handle line here
>
> with this:
>
> repeat:
> line = sys.stdin.readline()
> while line:
> pass # handle line here
>
> Semantics are unchanged. If Python had a goto, it could also be
> expressed like this:
>
> goto entrypoint
> while line:
> pass # handle line here
> entrypoint:
> line = sys.stdin.readline()
>
> Or should I write this up as a PEP?
>
> --
> -russ nelson will be speaking at
http://www.osdn.com/conferences/handhelds/
> Crynwr sells support for free software | PGPok | Mailing lists should not
set
> 521 Pleasant Valley Rd. | +1 315 268 1925 voice | Reply-To: back to the
list!
> Potsdam, NY 13676-3213 | +1 315 268 9201 FAX |
http://russnelson.com/rt.html
More information about the Python-list
mailing list