-3

Does anyone know how to represent the do..while in Cython?

Ex: http://www.tutorialspoint.com/cprogramming/c_do_while_loop.htm

too honest for this site
  • 12,050
  • 4
  • 30
  • 52
Mano-Wii
  • 592
  • 5
  • 19

1 Answers1

2

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.

Community
  • 1
  • 1
Shawn Mehan
  • 4,513
  • 9
  • 31
  • 51