Class returning None ?
Cliff Wells
clifford.wells at comcast.net
Mon Jan 26 03:55:46 EST 2004
On Mon, 2004-01-26 at 00:43, George Marshall wrote:
> Hi, I'm wondering, what's the best way to check for
> success or failure on object initialization ?
Raise an exception.
> This is my ugly workaround to do that :
[snip]
> What's the python way to do that ?
from exceptions import Exception
class SomeError(Exception): pass
class mytest:
def __init__(self):
if not everythingok():
raise SomeError
def main():
try:
a = mytest()
except SomeError:
return 1
Regards,
Cliff
--
Pushing the stone up the hill of failure
-Swans
More information about the Python-list
mailing list