A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-March/043353.html below:

[Python-Dev] why string exceptions are bad

[Python-Dev] why string exceptions are bad [Python-Dev] why string exceptions are badBarry Warsaw barry at python.org
Fri Mar 19 17:41:54 EST 2004
On Fri, 2004-03-19 at 17:30, Jewett, Jim J wrote:

> A class can be defined in a single place (and imported); 
> a typo in the 47th raise statement will show up as a syntax
> error instead of a runtime bug.

Yes, but I'll just note that this is "safe":

foo.py
------
Error = 'Bogus Error'

def foo():
	...
	raise Error


bar.py
------
import foo

try:
	foo.foo()
except foo.Error:
	# oops!


That works because you're raising and catching the same object.  String
exceptions still suck though. :)

-Barry



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