On Thu, Nov 11, 2010 at 1:08 PM, Aaron Meurer <[email protected]> wrote:
> How difficult would it be to provide a model like Maple, where the
> common functions are imported by default, but if you want more
> advanced things you have to import the module?  The difficulty, the
> common functions and more advanced ones might be in the same file.
> So, for example, you might want to import dsolve() by default, but not
> classify_ode() (similar to how dsolve() is imported by default in
> Maple, but to use odeadvisor(), you have to do with(DETools)), but
> both live in ode.py.  Does Python make it easy to do this sort of
> thing, or at least has someone written something that makes it easy to
> do?

We need to experiment. I think we all agree that something like you
describe is desirable to do.

I think that basic "import sympy" should only import the core, plus
some basic functions, and then limits, integrals, solve, dsolve. Maybe
some more things.

And the rest should simply by not imported at all, and the user has to
import it by hand. That means, that dsolve() has to import the stuff
from withing the function itself, so that it gets "lazy imported".

>
> Or another idea would be to just import ode (the module) into the
> namespace, and then you just use ode.classify_ode(), or from ode
> import classify_ode if you are going to use it a lot.  Or does this
> take just as much time as importing into the global namespace in the
> first place?
>
> Also, I have heard that it might be possible to do lazy importing, so
> for example, you don't actually import all the internal functions in
> ode.py until someone calls dsolve().  You should be able to do some
> magic using __import__() in either case, right?
>
> Can we do more advanced benchmarks to see which modules are slowing
> the import time down the most?

I do that usually by commenting out things in the sympy/__init__.py.
The problem is that sometimes things are interrelated, so one needs to
be a bit careful.

Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to