
Feb. 26, 2009
4:09 p.m.
On Thu, Feb 26, 2009 at 8:44 AM, Calvin Spealman <ironfroggy@gmail.com>wrote:
But... Do we also add try for:, try if:, try while:, etc.? Not terrible, but potentially terrible.
No, because they're rarely useful. Modifying my script a little, less than 1% of my "if" and "for" statements are immediately preceded by "try", compared to 68% of my "with" statements. "with" blocks very frequently define the scope of an object that might generate a particular type of exception (e.g., file object may throw IOErrors, SQL transactions might through SQL exceptions, etc.). -- Daniel Stutzbach, Ph.D. President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>