KraftDiner wrote: > I'm porting a routing from C++ to python. > There is a complex for loop that I don't know how to code in python > > for (i = nPoints-1, j = 0; j < nPoints; i = j, j++)
i = nPoints - 1 j = 0 while j < nPoints: # do stuff i = j j += 1 For loops in C aren't really complicated. They have stuff that happens before the loop is entered, a test that occurs at the top of the loop before each pass, and stuff that happens at the end of the loop just after the body has executed. Using a while loop in Python makes it mechanical to translate any such C for loop... -Peter -- http://mail.python.org/mailman/listinfo/python-list