nb_multiply and different types

Andrew Wilkinson ajw140NO at SPAM.york.ac.uk
Thu Dec 18 00:10:55 CET 2003


I'm trying to wrap a Vector and Matrix class I have written in C into Python
types. Everything is working nicely, except for the Matrix multiply by
Vector function.

I have defined an nb_multiple callback, and it works fine for Matrix *
Matrix - but it's not even getting called for Matrix * Vector - Python is
deciding for me that its of the wrong type, and raising a type error. How
do I persuade it that I know what I'm doing?

I have seen about about coercing, but I'm not sure if that'll do what I want
- if someone could give me an example that'd be muchly appreciated.

Thanks in advance,
Andrew Wilkinson

I like nonsense, it wakes up the brain cells.

More information about the Python-list mailing list