Thanks for the help.
Tom Anderson writes:
class NeverRaised(Exception):
def __init__(self, *args):
raise RuntimeError('NeverRaised should never be raised')
Briliant! Although i'd be tempted to define an UnraisableExceptionError
to signal what's happened. Or ...
A package we are
Tom Anderson wrote:
class NeverRaised(Exception):
def __init__(self, *args):
raise RuntimeError('NeverRaised should never be raised')
Briliant! Although i'd be tempted to define an
UnraisableExceptionError to signal what's happened. Or ...
class ImpossibleException(Exception):
I'd like an 'except exception which is never raised' statement
Is there a defined way to do that, for Python 2.2 and above?
'except None:' works for now, but I don't know if that's safe:
for ex in ZeroDivisionError, None:
try:
1/0
except ex:
print
Hallvard B Furuseth [EMAIL PROTECTED] writes:
'except None:' works for now, but I don't know if that's safe:
for ex in ZeroDivisionError, None:
try:
1/0
except ex:
print Ignored first exception.
class NeverRaised(Exception): pass
for ex in
Paul Rubin writes:
Hallvard B Furuseth [EMAIL PROTECTED] writes:
'except None:' works for now, but I don't know if that's safe:
for ex in ZeroDivisionError, None:
try:
1/0
except ex:
print Ignored first exception.
class NeverRaised(Exception):
Hallvard B Furuseth [EMAIL PROTECTED] writes:
class NeverRaised(Exception): pass
for ex in ZeroDivisionError, NeverRaised:
Heh. Simple enough. Unless some obstinate person raises it anyway...
Hmm, ok, how's this?:
def NeverRaised():
class blorp(Exception): pass
return blorp
Paul Rubin wrote:
Hallvard B Furuseth [EMAIL PROTECTED] writes:
class NeverRaised(Exception): pass
for ex in ZeroDivisionError, NeverRaised:
Heh. Simple enough. Unless some obstinate person raises it anyway...
Hmm, ok, how's this?:
def NeverRaised():
class
On Tue, 10 Jan 2006, Duncan Booth wrote:
Paul Rubin wrote:
Hallvard B Furuseth [EMAIL PROTECTED] writes:
class NeverRaised(Exception): pass
for ex in ZeroDivisionError, NeverRaised:
Heh. Simple enough. Unless some obstinate person raises it anyway...
Hmm, ok, how's this?:
def