News for hackers. Stuff that matters.
Re:I got asked LeetCode questions for a dev-ops systems engi... by confusedcoder on Friday June 14, 2019 @07:03PM (#20187373)
Forgive me because I have used a similar idom when dealing with io.

I do something like:

  for i=0; i<3; i++:
    try:
      doSomeIoWork()
    catch:
      if i<3:
        # maybe some network/disk issues retry?
        sleep SOME_TIME * i;
        continue;
      else:
        # tried too many times now quit
        raise
Am I doing something stupid here?
Re:I got asked LeetCode questions for a dev-ops systems engi... by kamaal on Saturday June 15, 2019 @06:57AM (#20189398)
Nothing. Probably the original developer was trying to do the same thing. There is always a context to what some one is doing.
Re:I got asked LeetCode questions for a dev-ops systems engi... by pault on Sunday June 16, 2019 @02:22PM (#20197040)
I think the try/catch block is confusing commenters; it's irrelevant to the control flow in this case. You could consider it equivalent to:

  for i=0; i<3; i++:
    doSomething();
    if i<3:
      continue;
    else:
      break;
Re:I got asked LeetCode questions for a dev-ops systems engi... by hackinthebochs on Saturday June 15, 2019 @12:07PM (#20190608)
Well the continue isn't doing any work for you since the else clause prevents the raise from being called.