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
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
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
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
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
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