J
James Stroud
Hello All,
Is this a bug? Why is this tuple getting unpacked by raise? Am I missing some
subtle logic? Why does print not work the same way as raise? Both are
statements. Why does raise need to be so special?
py> sometup = 1,2
py> print sometup
(1, 2)
py> print 1,2,3, sometup
1 2 3 (1, 2)
py> class MyErr(Exception):
.... def __init__(self, atup):
.... Exception.__init__(self, "Error with %s-%s" % atup)
....
py> raise MyErr, sometup
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: __init__() takes exactly 2 arguments (3 given)
py> e = MyErr(sometup)
py> print e
Error with 1-2
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
Is this a bug? Why is this tuple getting unpacked by raise? Am I missing some
subtle logic? Why does print not work the same way as raise? Both are
statements. Why does raise need to be so special?
py> sometup = 1,2
py> print sometup
(1, 2)
py> print 1,2,3, sometup
1 2 3 (1, 2)
py> class MyErr(Exception):
.... def __init__(self, atup):
.... Exception.__init__(self, "Error with %s-%s" % atup)
....
py> raise MyErr, sometup
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: __init__() takes exactly 2 arguments (3 given)
py> e = MyErr(sometup)
py> print e
Error with 1-2
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/