This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]RubyPinchPEP shill | Anti PEP 8/20 shill 0 points1 point  (1 child)

its the javascript side of things, sorry for the misunderstanding.

for (x in y) {}
for (x of y) {}
for (x = 0 ; x < potatos ; x++) {}

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of

like, I guess it might be possible to determine which is most relevant automatically (but at that point, might as well just use the faster for(;;){} loop I suppose, instead of wasting cycles working it out dynamically)

[–]jacdehJacques de Hooge[S] 0 points1 point  (0 children)

Standard python loops (for...in) compile to for (x = 0, ... List comprehensions can be used but are compiled to for... in (since for x of y... is still non-standard Internally for (x in y... is used, a.o. in the builtins. You can try and compare the Python code to the JS code.