Python compiler
Chris Barker
chrishbarker at home.net
Thu Jul 5 13:58:16 EDT 2001
Paul Prescod wrote:
> but I would say that if what you need is speed, the best solution
> is often to code in Python and then rewrite your inner loops in C.
That's what I do, but I have to say that I am very disappointed that I
have to. Now I have to know 2 languages (I'm not very good at C). What I
have found is that, as Paul suggests, you really only need that
"compiled" speed for a very small subset of your programs, but I end up
having to spent a week re-coding a small function in C that I wrote in a
couple of hours in Python (and I had the algorithm worked out already!)
If I was more experienced at C, it would be faster, but still a lot more
time. That's why I use Python in the first place. Personally, I'm
looking forward to the proposed "optionally static typing" for Py3k. If
this were combined with a revival of Py2C, I would probably never have
to write C again!
> Or even profile your Python and then optimize it. You'll be amazed how much
> speed you can squeeze out if you concentrate on your problem areas.
This works too (and use Numeric!) that's why I have only had to write a
handful of C functions in a couple of years of heavy Python use. That's
still a handful more that I would have liked.
-Chris
--
Christopher Barker,
Ph.D.
ChrisHBarker at home.net --- --- ---
http://members.home.net/barkerlohmann ---@@ -----@@ -----@@
------@@@ ------@@@ ------@@@
Oil Spill Modeling ------ @ ------ @ ------ @
Water Resources Engineering ------- --------- --------
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------
More information about the Python-list
mailing list