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,name):
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 least that is
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 hack at
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 vaguely uneasy about
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
method calls in exception
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 plain
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 Pythoneers,
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 will end up
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
method