diff options
author | Guido van Rossum <guido@python.org> | 1996-12-10 18:07:35 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1996-12-10 18:07:35 (GMT) |
commit | 0aa9ee65ab66627c2d065d213090aec93e634ee9 (patch) | |
tree | ee0ec8ac491f39baddc05994df998553714bcd2e /Lib/test/testall.py | |
parent | 6c31a14de7b9a447fa476b773ae895b219f212e6 (diff) | |
download | cpython-0aa9ee65ab66627c2d065d213090aec93e634ee9.zip cpython-0aa9ee65ab66627c2d065d213090aec93e634ee9.tar.gz cpython-0aa9ee65ab66627c2d065d213090aec93e634ee9.tar.bz2 |
Moved the raise logic out of the main interpreter loop to a separate function.
The raise logic has one additional feature: if you raise <class>,
<value> where <value> is not an instance, it will construct an
instance using <value> as argument. If <value> is None, <class> is
instantiated without arguments. If <value> is a tuple, it is used as
the argument list.
This feature is intended to make it easier to upgrade code from using
string exceptions to using class exceptions; without this feature,
you'd have to change every raise statement from ``raise X'' to ``raise
X()'' and from ``raise X, y'' to ``raise X(y)''. The latter is still
the recommended form (because it has no ambiguities about the number
of arguments), but this change makes the transition less painful.
Diffstat (limited to 'Lib/test/testall.py')
0 files changed, 0 insertions, 0 deletions