Translate this to python?

Patrick Maupin pmaupin at
Wed Jan 4 01:04:19 EST 2006

Peter Hansen wrote:

> Though, without knowing what the body does, one can't be sure
> that's going to be a faithful translation.  The for loop in Python
> always iterates over the entire set of items given to it, unless
> it's told to break early.  But if "j" or "nPoints" is modified in the
> body of the C for loop, the loop might execute a different
> number of times than the above Python for loop would.

> (I agree it appears unlikely that the OP's code is going
> to do that, but it's worth mentioning for safety.)

You are absolutely correct, sir.

I definitely made the assumption that either: a) the OP presented his
_entire_ loop control code for our perusal, or that b) the OP could
possibly learn to do a better job of phrasing his questions (ESR
treatise, anyone?) in the future if he finds out that my response is
inadequate due to his incomplete description of the problem.

Whether none, either, or both of these assumptions is a mistake is a
question only the OP can answer :)


More information about the Python-list mailing list