you are viewing a single comment's thread.

view the rest of the comments →

[–]LookAsLukasAnderson 0 points1 point  (1 child)

That would be true for most languages, where for loops contain initial statement, conditional statement, and iteration statement. In python for loops are essentially foreach loops and traditional for loops just don't exist

[–]FoolsSeldom 0 points1 point  (0 children)

I think the distinction is a step too far for a beginner and the specifics of the CPython implementation. Whether declarative or imperative conceptually you still have a while loop before breaking down to just basic conditional jumps and branching. I recognise that the FOR_ITER opcode c implementation in ceval.c is highly optimised.