[Pyrex] Special methods do not type cast 'self'
Greg Ewing
greg.ewing at canterbury.ac.nz
Wed Jul 19 01:03:33 UTC 2006
Stefan Behnel wrote:
> def __add__(self, other):
> return self._value() + other
>
> This does not work.
This is not a bug. You need to study what the Special Methods
of Extension Types page has to say about the binary operator
methods.
Briefly, either the first *or* the second argument of __add__
could be self. You need to type-test the arguments to find
out which.
--
Greg
More information about the Pyrex
mailing list