That was a little disappointing
Nothorrible, buttoo slow to do some coolstuff.
Options for doing better
2. C extension
4. There are others (numpywith numexpr)
Fast, compliantalternative implementation of the Python
language (2.7.6 and 3.2.3) with severaladvantages:
Speed, due to Just-In-Time compiler
Takes less memory
Supports anumber of third partylibraries:
ctypes, django, sqlalchemy, twisted, etc.
Does notrequire anychange to your code!
Unfortunately, matplotlib is notsupported.
Write functions in C thatare callable from python
Pass python objects as arguments thatmustbe converted to C
Returns apython object, e.g., alist
Compiled and fast
Do this atleastonce
Compiling to an importable module
Create asetup.pyfile, e.g:
And itcan be imported and called
Static compiler for python
Makes writingC extensions for python as easyas writing
Generates C code from your python code
Has the potentialto deliver the speed gains thatwe getfrom aC
extension with less hassle
How to make it work
Build like this:
Then you can importfrom
Making cython faster
Cython's code generation is helped byprovidingithints in the
form of type declarations