[issue6220] typo: opne in "doanddont"

Ezio Melotti report at bugs.python.org
Sat Jun 6 12:13:26 CEST 2009


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

That "typo" is intentional, it's also written in the comment:
try:
    foo = opne("file") # misspelled "open"
except:
    sys.exit("could not open file!")

This example shows how a bare except will catch the NameError caused by
'opne' and return the wrong error message, whereas "except IOError" will
only catch IOErrors and show the NameError.

----------
nosy: +ezio.melotti
resolution:  -> invalid

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6220>
_______________________________________


More information about the Python-bugs-list mailing list