syntax question - if 1:print 'a';else:print 'b'
James Stroud
jstroud at mbi.ucla.edu
Thu Oct 27 16:29:16 EDT 2005
On Thursday 27 October 2005 11:16, Carsten Haese wrote:
> On Thu, 2005-10-27 at 14:00, Gregory Piñero wrote:
> > Not quite because if something(3) fails, I still want something(4) to
> > run.
>
> def something_ignore_exceptions(x):
> try: something(x)
> except: pass
>
> something_ignore_exceptions(1)
> something_ignore_exceptions(2)
> # etc...
I'm at the point where I don't understand why you can't use this:
def try_somethings(alist):
def try_something(el):
try:
something(el)
except e:
do_exception(el, e)
for an_el in alist:
try_something(an_el)
See also <http://www.artima.com/intv/dry.html>.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
More information about the Python-list
mailing list