Does anyone know how to represent the do..while in Cython?
Ex: http://www.tutorialspoint.com/cprogramming/c_do_while_loop.htm
Does anyone know how to represent the do..while in Cython?
Ex: http://www.tutorialspoint.com/cprogramming/c_do_while_loop.htm
Firstly, and most importantly, Cython supports for
and while
loops as found in Python without modification.
Secondly, Python does not have a do-while
implementation. Hence, given the above, you can not do-while
in Cython.
You can, however, achieve the same result, as expressed in this excellent answer.
Finally, remember that there is magic in getting the most out of Cython. For example, if you are looping over a range call, you will probably want to type the range argument as a C int. If you are looping over a Python container, statically typing the loop indexing variable may well introduce additional overhead. Kurt W Smith's excellent Cython is a worthwhile read if you are really going to get under the hood.