On Tue, 15 Mar 2005 00:05:32 +1000, Nick Coghlan <[EMAIL PROTECTED]> wrote:
[...]
> Maybe what we really should be doing is trapping the TypeError, and 
> generating a
> more meaningful error message.
> 
> E.g.
> 
[...]
> ...   try:
> ...     value += first
> ...   except TypeError:
> ...     raise TypeError("Cannot add first element %r to initial value %r" % 
> (first, value))

No, no, no! NO! Never catch a general exception like that and replace
it with one of your own. That can cause hours of debugging pain later
on when the type error is deep down in the bowels of the += operation
(or perhaps deep down inside something *it* invoked).

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to