Problem is that now the else-part is also within the try block. It's easy to 
end up in a scenario where you want to catch the exception from e.g. `parseInt` 
but then your following logic can also throw an exception you don't want to 
catch. You might not even be aware that it is capable of throwing an error, or 
the API could change between versions without you being aware. My point is that 
putting it in that `else` block would make sure you're only actually catching 
exceptions from the thing you want to. Of course you could write it in Nim as:
    
    
    if (
      try:
        discard parseInt("123")
        true
      except:
        false):
      echo "Python's else part here"
    
    
    Run

Which is a bit meh, or even as:
    
    
    block tryBlock:
      try:
        discard parseInt("123")
      except:
        break tryBlock
      echo "Python's else part here"
    
    
    Run

Which is vaguely better, but the else part is still in a different scope.

Reply via email to