On Tue, 7 Apr 2009 at 09:01, andrew cooke wrote:
R. David Murray wrote:
  [...]
  try:
    dimensions.append(float(s))
  except:
    dimensions.append(float(quantization[s]))

No, no, no; never use a bare except! :)

can you explain why?  i can't think of any reason why the code would be
better catching a specific exception.

as a general rule, maybe, but in this particular case i can't see a reason
- so i'm not sure if you're just pedantically following rules or if i've
missed something i should know.

What if the user pressed ctl-c right when the float was being converted
and appended?

Never use a bare except unless you have a specific reason to do so,
and there are very few of those.  (Yes, I should have said it that way
to start with, my apologies for going hyperbolic.)  Using because it
doesn't _look_ like it will cause issues is just asking for hard to
track down bugs :).

--
R. David Murray             http://www.bitdance.com
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to