Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on PHP: why GOTO instead of recursion?. Parent comment
Yes, but that only requires a guard clause. That's what CPython 2 does in the same situation:
>>> import dis >>> def foo(): ... while True: ... print "ok" ... >>> dis.dis(foo) 2 0 SETUP_LOOP 15 (to 18) >> 3 LOAD_GLOBAL 0 (True) 6 POP_JUMP_IF_FALSE 17 3 9 LOAD_CONST 1 ('ok') 12 PRINT_ITEM 13 PRINT_NEWLINE 14 JUMP_ABSOLUTE 3 >> 17 POP_BLOCK >> 18 LOAD_CONST 0 (None) 21 RETURN_VALUE
There are no comments on this comment yet.
Yes, but that only requires a guard clause. That's what CPython 2 does in the same situation:
(in Python 3, True and False are keywords so the loop prelude can be elided entirely)