>>>>> "AB" == Anthony Baxter <[EMAIL PROTECTED]> writes:

  AB> Now, it's obvious that not all of these are bad - some are
  AB> probably fine - but there's also many that are _not_ good. The
  AB> one in MailHost.py does eat exceptions. I'm sure there are
  AB> others.

I am probably a bit idiosyncratic, but I prefer to avoid bare excepts
at all costs.  I often use "except Exception:", otherwise I add a
comment that specifically notes that I intend to catch everything.
Otherwise, you can't tell the difference between intentional and
accidental use.

  AB> I've done a quickie hack script that runs over the source and
  AB> produces a list of matches to lines in the file, and links to a
  AB> lightly patched viewcvs so that you can jump straight to the
  AB> lines. It seems like it would be reasonably easy to make this a
  AB> bit more sophisticated to include things like the nesting 'def'
  AB> and 'class' method.

  AB> This, to me, seems like a pretty nice community type task -
  AB> people could take one of them off the list of unchecked ones,
  AB> and have a look through the code... no?

It would also be interesting to see how many try/except blocks are
including more code than they should.  The larger the block, the more
likely that a line of code raises an error that the author didn't
consider; these errors can mean that real bugs get caught be accident
and ignore.  When the block is small -- preferably just a line or two
-- there is litle chance for error.  Of course, there are very good
reasons to have longer except blocks.


Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to