On Sat, 24 May 2008 13:13:08 +0200, Johannes Bauer wrote:

> George Sakkis schrieb:
> 
>>> However, this "assignment and comparison" is not working. What's the
>>> "Python way" of doing this kind of thing?
>> 
>> The most obvious and readable of course: use two statements, as one
>> should do regardless of the language, instead of resorting to error-
>> prone hacks.
> 
> As I said in the reply to Carl, this might be okay for if-clauses, but 
> is bothering me with while-loops.

Then try to write the ``while`` loop as ``for`` loop and move the
comparison into a generator function, or use the two argument variant of
`iter()`, or `itertools.takewhile()`.

Ciao,
        Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to