Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Doesn't what you wrote work in a different, slower, way?

I had in mind something analogous to

    r = []
    for x in range(5):
      if 2>x:
        for y in range(5):
          r.append((x,y))
I think what you wrote probably does:

    r = []
    for x in range(5):
      for y in range(5):
        if 2>x:
          r.append((x,y))
The first loop completely skips looping over y if the condition on x fails, the second loop repeatedly tests x.


Hurm yes indeed. Interesting problem. I'll copypasta this and fix up an issue! Nice catch!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: