[Pyrex] Total newbie needs code review

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Sep 9 05:06:16 CEST 2005


Grant McDonald wrote:
>  >       raise "init failed, returned %d" % ret
> 
> raising string exceptions is deprecated and will be removed in python 3. 

Whoops, missed that one! What's more, you're actually using
string exceptions INCORRECTLY here. It would be impossible to
catch the string you're raising here with a try-except,
because exceptions are matched by identity rather than
equality.

As noted, you should raise an instance of a class instead.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+



More information about the Pyrex mailing list