Hacker News new | ask | show | jobs
by RussianCow 3927 days ago
How would you expect the second one to work?
1 comments

I guess similarly to C:

  for i in foo:
    print(42)
would be considered equivalent to something like

  it = iter(foo)
  while True:
   try:
    i = next(it)
   catch StopIteration:
    break
   print(42)
and jumping to print(42) would skip the init and first iteration expression.

Of course that's non-obvious behaviour, so in practice you would make it a compile time error. A careful language designer might even decide to not support goto at all. :)