Conditional Expressions don't solve the problem

Kevin D salemail at dial.pipex.com
Thu Oct 18 09:53:43 CEST 2001


Hi Dale,

Dale Strickland-Clark <dale at riverhall.NOTHANKS.co.uk> wrote in message 
news:<c5hrstgg36jicro79k1ir876iduugjkci3 at 4ax.com>...
> >
> >Something like:
> >
> >while foo != terminating_condition; given foo = some_long_expression:
> >    body_of_loop()
> >
> >or maybe "where":
> >
> >while foo != terminating_condition; where foo = some_long_expression:
> >    body_of_loop()
> >
> 
> Sorry but these don't work for me. Given that foo is still quoted
> twice, it doesn't really buy you much.

It's spelling 'some_long_expression' twice that was the 'duplication
problem' I was addressing. Trying to avoid spelling 'foo' twice (eg,
by overloading a single expression to be an assignment _and_ a test)
falls into "saving keystrokes for the sake of it" territory, which is
what Guido has already said he will not consider.

My suggesting is not trying to "save keystrokes" - it's trying to save
duplication of an expression that doesn't _need_ to be written twice.
This is one of the arguments that got augmented assignment into the
language.

Regards, Kev.



More information about the Python-list mailing list