[Python-Dev] Re: ANN: Pyrex - a language for writing Python extension modules (original) (raw)
Greg Ewing greg@cosc.canterbury.ac.nz
Wed, 10 Apr 2002 14:29:02 +1200 (NZST)
- Previous message: [Python-Dev] Stability and Change
- Next message: [Python-Dev] test_mpz skipped?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Skip Montanaro <skip@pobox.com>:
Interesting, but why not simply attach the type information to function attributes so the Pyrex code really is just Python?
I imagine that would look extremely ugly. Also, functions aren't the only places that type information, and other kinds of information, is needed in Pyrex. Have you read the Language Overview? There's much, much more to Pyrex than just annotating things with types.
You can defer Pyrex compilation until you realize you need it. Naively compiling all your code to C makes for a lot of (object) code bloat and doesn't necessarily speed anything up (if, for example, the code is I/O bound or not executed frequently enough). This was one of the problems with Python2C.
You're not meant to compile all your Python code with Pyrex. You only put Python code in a Pyrex module if it's needed to interface with non-Python code. Pyrex isn't designed to speed up Python code, but to bridge the gap between Python and non-Python. Speed, if any, comes from the non-Python code (Pyrex code operating on C data, or external C code).
Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
- Previous message: [Python-Dev] Stability and Change
- Next message: [Python-Dev] test_mpz skipped?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]