Carl Banks wrote:
> mwt wrote:
>> In my latest attempt at some Python code, I've been tempted to write
>> something in the form of:
>>
>> try:
>> [...] #doing some internet stuff
>> except IOError:
>> alternate_method_that_doesnt_need_internet()
>>
>> This works when I try it, but I feel va
"mwt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> In my latest attempt at some Python code, I've been tempted to write
> something in the form of:
>
> try:
> [...] #doing some internet stuff
> except IOError:
> alternate_method_that_doesnt_need_internet()
>
I'm only a hac
mwt wrote:
(snip)
>>>This works when I try it, but I feel vaguely uneasy about putting
>>>method calls in exception blocks.
>>
>>What do you put in exception blocks?!
Whatever fits the specific case...
(snip)
> Normally I don't like to use exception blocks to do condition-statement
> stuff. At le
Carl Banks wrote:
> In fact a lot of Pythonistas recommend this way over the
> alternative, even when you don't have to. For example, a lot of people
> recommend this:
>
> try:
> name = record.name
> except AttributeError:
> name = "Freddy"
>
> instead of this:
>
> if hasattr(record,"
mwt wrote:
> In my latest attempt at some Python code, I've been tempted to write
> something in the form of:
>
> try:
> [...] #doing some internet stuff
> except IOError:
> alternate_method_that_doesnt_need_internet()
>
> This works when I try it, but I feel vaguely uneasy about putting
>
Felipe Almeida Lessa wrote:
> Em Qua, 2006-04-19 às 16:54 -0700, mwt escreveu:
> > This works when I try it, but I feel vaguely uneasy about putting
> > method calls in exception blocks.
>
> What do you put in exception blocks?!
>
>
> > So tell me, Brave Pythoneers, is this
> > evil sorcery that I
Felipe Almeida Lessa wrote:
> Em Qua, 2006-04-19 às 16:54 -0700, mwt escreveu:
> > This works when I try it, but I feel vaguely uneasy about putting
> > method calls in exception blocks.
>
> What do you put in exception blocks?!
Usually I just print an error message.
>
>
> > So tell me, Brave Py
Em Qua, 2006-04-19 às 16:54 -0700, mwt escreveu:
> This works when I try it, but I feel vaguely uneasy about putting
> method calls in exception blocks.
What do you put in exception blocks?!
> So tell me, Brave Pythoneers, is this
> evil sorcery that I will end up regretting, or is it just plai