Exceptions
Tetsuo
member16943 at dbforums.com
Thu Feb 6 14:24:40 EST 2003
Originally posted by Chad Netzer
>
> """
> def Pythagoras(a,b):
> if type(a) != type(0) or type(b) != type(0):
> raise CorruptHardDiskError
> else:
> print (a**2 + b**2)**(1/2)
> return
>
> class CorruptHardDiskError(Exception):
> pass
>
> try:
> Pythagoras(18, "x")
> except CorruptHardDiskError:
> print "Not a number!"
> """
>
>
>
I see... Finally. Thank you an above average amount.
Originally posted by Chad Netzer
>
>
>
>
Originally posted by Chad Netzer
>
> Okay, if you knew all this part, that's okay. It was just something
> else to think about. But hopefully the exception example at the
> beginning was helpful.
>
>
I knew it, but forgot it... Thanks. Although the program I'm actually
making actually uses a caustic mixture of integers and strings (or more
simply, extracts integers from a string).
But some of you people are kinda boring... Nobody even raised an eyebrow
at how I named that error. Is that standard practice or something?
--
Posted via http://dbforums.com
More information about the Python-list
mailing list