Inconsistency in retrieving exceptions via sys module

2008-05-12 Thread Raj Bandyopadhyay
Hi I am writing some C code which sets and retrieves a Python exception. I set the exception using PyErr_SetString(), and retrieve it in 2 ways: 1) using PyErr_Occurred() and 2) Using sys.exc_type. However, I get two different results and am very puzzled by this apparent inconsistency. Could

Question about overloading of binary operators

2008-03-31 Thread Raj Bandyopadhyay
Hi Here's a simple class example I've defined # class myInt(int): def __add__(self,other): return 0 print 5 + myInt(4) #prints 9 print myInt(4) + 5 #prints 0 # The Python binary operation function (binary_op1() in Objects/a