Custom Search

Sunday, April 17, 2011

python raise statement with argument and with no argument difference


1) python raise statement with argument.

try:
5 / 0
except Exception, e:
raise e

Output
=====
Traceback (most recent call last):
File "del me.py", line 5, in
raise e
ZeroDivisionError: integer division or modulo by zero

===================

2) python raise statement with no argument.

try:
5 / 0
except Exception, e:
raise e

Output
=====
Traceback (most recent call last):
File "del me.py", line 3, in
5 / 0
ZeroDivisionError: integer division or modulo by zero



No comments:

Post a Comment