[Pyrex] newbie list processing question
    Stefan Behnel 
    stefan_ml at behnel.de
       
    Mon May  5 21:31:48 CEST 2008
    
    
  
Daniel Ashbrook wrote:
> So I've done a lot of Google searching and haven't found an answer to 
> this question, or at least one that I understand.
> 
> I'm trying to write some fairly simple list-processing code using pyrex. 
> As a simple example, let's say I wanted to translate this:
> 
> def addOne(l):
>    assert(isinstance(l, list))
>    for i in xrange(l):
>      l[i] += 1
> 
> or even this:
> 
> def addOne(l):
>    return [i+1 for i in l]
> 
> to fast-running pyrex code. How can I actually access the list properly? 
Take a look at Cython. It supports list comprehensions, so the above just works.
http://cython.org/
Stefan
    
    
More information about the Pyrex
mailing list