About some problem

André Malo ndparker at gmail.com
Fri Jan 3 15:28:37 EST 2014


* Steven D'Aprano wrote:

> Mark Lawrence wrote:
> 
>> raise "Not Valid DB Type"
>> 
>> is perfectly valid in Python 2.
> 
> Actually, no it isn't. It's only valid up to Python 2.4. In Python 2.5,
> string exceptions display a warning but continue to work, and in Python
> 2.6 they generate a compile-time SyntaxError.

Oh? Doesn't look like it.

$ cat x.py
try:
    raise "foo"
except:
    print "bar"

$ python2.7 x.py
bar
$ python2.6 x.py
bar

A lone '''raise "foo"''' raises a TypeError, though.

nd
-- 
sub the($){+shift} sub answer (){ord q
        [* It is always 42! *]       }
           print the answer
# André Malo # http://pub.perlig.de/ #



More information about the Python-list mailing list