Hey I am wondering how does Java exceptions model differ that in C++ and Python?
I thought it was that only Java had checked exceptions, but from what I read Python also has checked exceptions?
Any thoughts would be great, Thanks
Hey I am wondering how does Java exceptions model differ that in C++ and Python?
I thought it was that only Java had checked exceptions, but from what I read Python also has checked exceptions?
Any thoughts would be great, Thanks
Python does not have checked exceptions. But it does have exception handling mechanics.. e.g.
def test():
raise Exception()
try:
test()
except Exception:
print "bugger."
# but its totally legal to just call it, and let any uncaught exceptions propagate
test()
is entirely legal thanks to the design of the python virtual machine,
public static void TestMethod(){
throw new Exception();
}
on the other hand running code that could throw an exception (that the compiler will detect) that is not explicitly checked in Java is totally illegal. It just can't be done thanks to the design of the JVM and the byte compiler.