The point: int('') or int('something') both throw an error.
Well, that's a bug. Obviously they should return 42.
Or is that 23? I forget.
But seriously... of course they do. What did you expect them to do?
Any Python function will raise an exception if you pass invalid data to
it. So the solutions are, don't pass invalid data, or wrap the function
in a try block. If you don't want to use try, then make sure that your
data is good.
In general,
this is hand-holding, but in specific I don't think the "rich and
structured" documentation will cover how to beat a 0 out of it in less
than 3 lines. So I will persist in my idiotic questions here!
They will tell me how to use except: (which is a good example why a
program should not use exceptions for its normal control flow if at all
possible).
Huh? So because YOU don't know how to use except, programs shouldn't use
exceptions for flow control? I reject that, and I will continue using
exceptions for flow control when I think it is appropriate.
Please, please, please save your newbie admonitions for those who
qualify!
Oh please, get off your high horse. You're asking newbie questions, no
matter how many years of using Python you may or may not have, your
experience is obviously low. Stick around and you might learn something,
but if you bite every time somebody tries to teach you, you'll soon run
out of people willing to help you.