
May 19, 2011
10:33 a.m.
On 19 May 2011 00:13, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
Devin Jeanpierre wrote:
On Wed, May 18, 2011 at 6:07 AM, dag.odenhall@gmail.com <dag.odenhall@gmail.com> wrote:
except IOError(32): # isinstance IOError and .args == (32,) ...
Unfortunately, as described it wouldn't match IOError(32, 'Blah blah blah').
Also it's a bit magical -- normally one doesn't expect Haskell-like pattern matching in Python.
Maybe something more explicit would be better:
try: ... except IOError as e with e.errno == 32: ...
Then we're back where we started in which case I prefer 'if' as the keyword.