Wednesday, November 12, 2014

except block types evaluated lazily

>>> try:
...    raise Exception()
... except Exception:
...    print "OK"
... except doesntexist:
...    pass
...
OK
>>>
>>> try:
...    raise Exception()
... except doesntexist:
...    pass
... except Exception:
...    print "OK"
...
Traceback (most recent call last):
  File "<stdin>", line 3, in <module>
NameError: name 'doesntexist' is not defined

1 comment:

  1. This Python blog is very interesting. By the way, I found your website when exploring business assignment writing service, and I appreciate you sharing it. Python is a computer language used to create apps and websites, automate processes, and analyze data.

    ReplyDelete