Conditional Expressions don't solve the problem
dale at riverhall.NOTHANKS.co.uk
Wed Oct 17 00:40:45 CEST 2001
"Andrew Dalke" <dalke at dalkescientific.com> wrote:
>Wouldn't you prefer (in Python 2.2)
>for term in iter(self.nextTerm, None):
> for a in argObjects:
> if a.test(term):
> raise whatever
>Same number of lines. No need for ':='. No ugly flag
>variables. Very Pythonic.
> dalke at dalkescientific.com
That looks OK. Somehow for/else had eluded me but I'm using it now.
Thanks for that.
Having not seen this before, I'm a bit surprised at the choice of the
word 'else' here. It's not an alternative. It's a conclusion. I would
have thought 'then' or 'finally' would have been more appropriate.
A bit late now, I guess.
Is iter just an extra object layer to map the interface. Will it be an
Riverhall Systems Ltd
More information about the Python-list