When raising an exception with a value for instance an integer you
assume that when catching the exception the value can be compared with
other integers. That is not what happens.
try:
raise Exception, 12
except Exception, number:
print number == 12
# False
This is because the number variable is a exception instance and not an
integer.
I wonder if I'm the only one which find this behavior odd, and if anyone
knows if there is a way to retrieve the original initialization value of
the exception.
ola
--
--------------------------------------
Ola Natvig <ola.natvig@inf osense.no>
infoSense AS / development
assume that when catching the exception the value can be compared with
other integers. That is not what happens.
try:
raise Exception, 12
except Exception, number:
print number == 12
# False
This is because the number variable is a exception instance and not an
integer.
I wonder if I'm the only one which find this behavior odd, and if anyone
knows if there is a way to retrieve the original initialization value of
the exception.
ola
--
--------------------------------------
Ola Natvig <ola.natvig@inf osense.no>
infoSense AS / development
Comment