Re: coding style - try, except

2009-02-25 Thread RGK
I'm glad I asked :) Thanks all who posted for your replies, the else-statement is a nice option. Python again comes through to deal with those pesky feelings that something could be better :) Ross. Chris Rebert wrote: Yes. try-except-*else*. try: do_something_1() do_something

Re: coding style - try, except

2009-02-25 Thread Christian Heimes
RGK wrote: > Any input appreciated :) How about: import logging try: # run your function some_function() except Exception: # except only the exceptions you *really* want to catch # at most you should except "Exception" since it doesn't # catch KeyboardInterrupt and SystemExit l

Re: coding style - try, except

2009-02-25 Thread Scott David Daniels
RGK wrote: I'm still learning, so eager to see if there is some community wisdom about use of the try/except structures in this situation try: do something 1 do something 2 do something 3 do something 4 ... do something 25 except: print "Oops something didn't

Re: coding style - try, except

2009-02-25 Thread Peter Otten
Steve Holden wrote: > RGK wrote: >> >> I'm still learning, so eager to see if there is some community wisdom >> about use of the try/except structures in this situation. >> >> I find myself with some potentially risky stuff and wrap it in a >> try/except structure with good functional results, t

Re: coding style - try, except

2009-02-25 Thread Chris Rebert
On Wed, Feb 25, 2009 at 9:36 AM, RGK wrote: > > I'm still learning, so eager to see if there is some community wisdom about > use of the try/except structures in this situation. > > I find myself with some potentially risky stuff and wrap it in a try/except > structure with good functional results

Re: coding style - try, except

2009-02-25 Thread Steve Holden
RGK wrote: > > I'm still learning, so eager to see if there is some community wisdom > about use of the try/except structures in this situation. > > I find myself with some potentially risky stuff and wrap it in a > try/except structure with good functional results, though my code leaves > me a b

coding style - try, except

2009-02-25 Thread RGK
I'm still learning, so eager to see if there is some community wisdom about use of the try/except structures in this situation. I find myself with some potentially risky stuff and wrap it in a try/except structure with good functional results, though my code leaves me a bit uneasy. Maybe it'