[Q] Are Exceptions used that much in practice?
jon at bezek.dstc.monash.edu.au
Thu Dec 14 08:29:37 CET 2000
David Bolen <db3l at fitlinxx.com> writes:
] In the case of IOError that does imply parsing a string and assuming
] it starts with [Errno #], which is sort of crufty. But other
] exceptions (such as those from win32all) are fairly standardized as a
] tuple with the code as the first element - something I also tend to do
] with my own user exceptions in my code.
Note that now that the standard exceptions are classes, IOError instances
have an errno attribute, which is even nicer than using tuple values.
f = open(filename, 'r'):
except IOError, exc:
if exc.errno == errno.ENOENT:
More information about the Python-list