[Pyrex] Quick 'len()' speedup for Pyrex
Jiba
jiba at tuxfamily.org
Thu Apr 22 21:19:19 CEST 2004
On Thu, 22 Apr 2004 14:05:56 -0400
"Phillip J. Eby" <pje at telecommunity.com> wrote:
> If your Pyrex code uses the 'len()' builtin, here's a handy quick fix
> you can pop in at the beginning of your code:
>
> cdef extern from "Python.h":
> int len "PySequence_Length" (object o) except -1
Does this work with user-defined len(), such as :
class MyClass:
def __len__(self): return 3
???
Jiba
More information about the Pyrex
mailing list