John Salerno escribió:
> 2. Between the if block or the try block, which is more Pythonic?
Since the command line argument is optional I don't think it should be
considered and exceptional condition if it's missing, so the "if" block
looks better to me. No idea if this is more pythonic.
> The
> try block seems nicer because it doesn't have such an ugly-looking check
> to make.
Ok, so you should do:
try:
x = 1/i
except ZeroDivisionError :
do_something_if_zero()
instead of
if (i == 0) :
do_something_if_zero()
HTH
--
http://mail.python.org/mailman/listinfo/python-list