[SciPy-User] leastsq and cython

David Baddeley david_baddeley@yahoo.com...
Sat Sep 25 16:03:38 CDT 2010

I've,  run into a similar problem, it's due to the fact that native methods (ie 
ones loaded from c libraries) are not quite the same as pure python function 
objects & don't possess all the nice attributes. It's been a while, but I seem 
to remember that this error crops up when leastsq is trying to print some form 
of status message with the function name in it. I've circumvented the problem by 
making a thin python wrapper function which just calls my c method. This works, 
but is not ideal, as you introduce additional function call overhead. If anyone 
out there knows of a better solution I'd also be interested.


----- Original Message ----
From: Till Stensitzki <mail.till@gmx.de>
To: scipy-user@scipy.org
Sent: Sun, 26 September, 2010 6:15:09 AM
Subject: [SciPy-User] leastsq and cython


i have a problem with scipy.optimize.leastsq and cython.
To make my fitting procedure faster and cythonized parts of it and got a 
factor 2 speedup.
But if i try to use the cython version with leastsq i get:
AttributeError: 'builtin_function_or_method' object has no attribute 

any suggestions?

I am using scipy 0.8 and cython 0.13 on Windows with Python 2.6.

SciPy-User mailing list


More information about the SciPy-User mailing list