> > I think the right way to write programs is to start in Python, and
> > later (when you know how) rewrite some parts to C, or C++ or
> > Cython to gain the maximum possible speed.
>
> If the program is the end-goal, that makes sense.
>
> If the program is itself a teaching tool, then you need to remember
> that anyone not already using it missed the history -- if you switch
> to optimized (but less clear) code, then they miss out of the
> easy-to-understand stage.

I completely agree. There are two goals - one is the program, but the
other is a clean Python implementation of symbolic manipulation.

> Within CPython itself, there is sometimes a tension between keeping
> library modules written in python, vs moving them to C for speed.  The
> closest there is to a standard answer (which is still evolving) is:
>
> module.py -- the normative version.  This should be complete, which
> also helps alternative implementations, such as Jython and the various
> .net versions.  [Note that in practice, it often isn't complete, but
> it should be, and the situation certainly shouldn't degrade.  One
> Google Summer of Code (Alexandre Vassalotti?) project helped with
> this.]
>
> _module -- some C speedups.  Users should not import this directly,
> but module should import it conditionally.
>
> The speedups should be imported by default, but it should be fairly
> simple to bypass them -- and both versions should be tested by the
> automated regression tests.  (There was at least talk of enhancing
> unittest to support this better.)

Thanks for the ideas. Yes, this is how I would like it to do it. The
only problem is that one needs to keep two versions - Python and C,
both updated.
But I definitely don't want to throw the nice Python implementation
away, because even though C is faster, Python has other advantages,
that C simply doesn't have.

In case of my own programs (electronic structure calculations), I
usually through the slow Python version away, because it's too much
work for me to keep both of them updated and just keep in my case only
the fortran version. But in case of SymPy, there are many advantages
to also have the Python version. Also for future - one never knows,
maybe the PyPy project will produce a really fast Python intepreter,
with JIT etc, that will provide almost the same speed as C.

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