http://cython.org/talks/SageX.pdf

Robert Collins robertc at robertcollins.net
Thu Sep 18 07:21:51 BST 2008


On Wed, 2008-09-17 at 10:50 -0500, John Arbash Meinel wrote:
> 
> So, I'd like to go over what we would actually *get* from switching to
> Cython. The items I see (page 17):

> 4) page 34, runtime checks to see if you can use raw offsets instead
> of
> __getitem__ indexing.
> 
> This is a bigger item, as it would save some of the manual hackery
> I've
> done with "PyTuple_GetItem".

It also helps PyList access, and 'for X in Y' expressions.

> 5) page 36, "len, hash, isinstance" have builtin equivalents. Seems to
> already be in Pyrex. (I see len(foo) get translated into
> PyObject_Length
> instead of looking up 'len' by name.) However, this again requires a
> newer Pyrex. (I think it is in 0.9.8 rather than 0.9.6.) I know I
> recently upgraded my pyrex on Windows, and I had to delete and
> re-create
> the .c file to get the updated 'len()' calls.

Upping the minimum pyrex version would be similar to switching to
cython, I think.

> 
> So, I would guess cython is "better" than pyrex. At a minimum it seems
> to have multiple developers, while Pyrex is a one-man integrator who
> wants to understand all changes (have deep knowledge of the full
> codebase). There is good in that, but it generally means it evolves
> more
> slowly. Also, nested imports in Pyrex are a bit clumsy. (you are
> supposed to name your C file foo.bar.pyx rather than foo/bar.pyx.)

Other things are seamless functions - that is
def foo(self, bar):
    pass

self.foo(bar)

in pyrex that goes through a python namelookup indirection; in cython it
acts as if it was 
cdef foo(self, bar)
instead, but still provides a python accessible version.

-Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080918/98b14490/attachment.pgp 


More information about the bazaar mailing list