Re Interest check in some delicious syntactic sugar for "except:pass"

Daniel Fetchinson fetchinson at googlemail.com
Wed Mar 3 09:33:30 EST 2010


> By way of motivation, I wrote that email after copying/pasting the
> following a few times around a project until I wrote it into def
> SilentlyDelete() and its cousin SilentlyRmdir()
>
> """ code involving somefile """
> try:
> ........os.remove(somefile)
> except:
> .......pass     # The bloody search indexer has got the file and I
> can't delete it. Nothing to be done.

You just found the right solution: define a function for something
that you do repeatedly. No need to change the language.

Cheers,
Daniel



-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown



More information about the Python-list mailing list