[Numpy-discussion] chebyshev, laguerre, ... exec() template code at each import

Andrew Dalke dalke@dalkescientific....
Tue Aug 6 21:32:29 CDT 2013

Hi all,

  I mostly develop software related cheminformatics. There
isn't much direct overlap between the tools of that field
and NumPy and SciPy provide, but it's increasing with the
use of scikit-learn and pandas.

  I tend to write command-line tools which indirectly
import numpy. I've noticed that 25% of the "import numpy"
cost of about 0.081 seconds is due to the chebyshev, laguerre,
legendre, hermite_e, and hermite_e modules. Each module
takes about 0.004 seconds to import.

  This is because each of them does a:

exec(polytemplate.substitute(name='Chebyshev', nick='cheb', domain='[-1,1]'))

during import. It appears that *everyone* takes a 0.02 second
overhead during "import numpy" in order to simplify maintenance.
This balance doesn't seem correct, given the number of people
who use numpy vs. how rarely the polytemplate changes.

Last year I submitted a patch which pre-computed all of those
templates, so they would only be byte-compiled once.

I knew (and still know) almost nothing about git/github, so
Scott Sinclair kindly took it up and made it a pull request at:


I see that there's been no activity for at least 10 months.

Is there anything more I can do to encourage that this patch
be accepted?



More information about the NumPy-Discussion mailing list