New to Python: Features

Josiah Carlson jcarlson at uci.edu
Wed Oct 6 16:35:41 EDT 2004


> Ah, that's what I meant.  So do you mean that I can not use Psyco 
> directly in the Pyrex code but I will have to apply it (by manually 
> editing them to import Psyco) to the Python leftovers?  I would think 
> that Pyrex would know to leave the imports alone and thus Psyco would be 
> fine.  I guess I shall have to test it for myself, thanks.

Pyrex is a Python-like langauge.  You send Pyrex through a preprocessor
that translates it into C.  You then compile that C into a Python module.

I am not sure that:
  import psyco
  psyco.full()
...will do anything useful in Pyrex code, so I wouldn't bother.

Let us say you manually translated 'mymodule.py' to 'mymodule.pyx' (or
wrote 'mymodule.pyx' directly), then ran the Pyrex preprocessor and a C
compiler to make 'mymodule.so' on a linux platform, and placed it in a
proper location.

Let us also say you have another module 'pythonmodule.py' which imports
'mymodule'.  If the psyco import and psyco.full() lines are in
pythonmodule.py (or any other python module that is imported), psyco
will do its thing on the Python source.

I do not know if leaving the psyco import and psyco.full() lines in
'mymodule.pyx' will do anything good or bad, as I have never tried such
a thing (for me, psyco is sufficient in the rare case that I need such
functionality).

 - Josiah




More information about the Python-list mailing list