Loop-and-a-half (Re: Curious assignment behaviour)
Dale Strickland-Clark
dale at riverhall.NOSPAMco.uk
Thu Oct 11 05:46:53 EDT 2001
Greg Ewing <greg at cosc.canterbury.ac.nz> wrote:
>I feel the solution to this is *not* to go in for
>any sort of assignment-in-expressions hackery, but
>to provide a decent loop-and-a-half control structure.
>My current idea for this is
>
> while:
> x = get_next()
> gives x:
> whatever(x)
I think I see what you're getting at but it doesn't really do it for
me.
The general loop construct as found in C and Java where you have three
expressions: initialisation, increment/iteration, test is a very
flexible and powerful approach which I really like.
--
Dale Strickland-Clark
Riverhall Systems Ltd
More information about the Python-list
mailing list