A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-March/052169.html below:

[Python-Dev] Rationale for sum()'s design?

[Python-Dev] Rationale for sum()'s design? [Python-Dev] Rationale for sum()'s design?Guido van Rossum gvanrossum at gmail.com
Mon Mar 14 18:36:23 CET 2005
On Tue, 15 Mar 2005 00:05:32 +1000, Nick Coghlan <ncoghlan at iinet.net.au> 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/)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4