On Thu, 10 Feb 2005 09:36:42 -0800, Jeff Shannon <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
And as Peter Hansen points out, none of the Python versions leave n in the same state that the C loop does, so that's one more way in which an exact translation is not really possible -- and (IMO again) further evidence that trying to do an exact translation would be ill-conceived. Much better to consider the context in which the loop is used and do a looser, idiomatic translation.
Yeah, though my background tends to be one which considers loop indices to be loop-local, value indeterminate after exit...
Well, even though I've programmed mostly in langauges where loop indices to retain a determinate value after exit, I almost always *treat* them as loop-local -- it just seems safer that way. But not everyone does so, and especially with C while loops, often the point is to keep adjusting the control variable until it fits the requirements of the next section...
Jeff Shannon Technician/Programmer Credit International
-- http://mail.python.org/mailman/listinfo/python-list