[Pyrex] [Cython-dev] Optimizing use of lists

Robert Bradshaw robertwb at math.washington.edu
Tue Nov 27 00:41:48 CET 2007


On Nov 26, 2007, at 3:33 PM, Greg Ewing wrote:

> Robert Bradshaw wrote:
>> I have thought for a while it would be nice to be able to do   
>> something like
>> cdef list L = [1,2,3]
>> print L[0]
>> which would do know to do things via the fast api
>
> I'm planning to do something very much like this in Pyrex
> some time soon, as part of my general "teaching it about
> the builtins" programme.

Great. I haven't started on this yet, so we should make sure to make  
things compatible.

>> except that it would do a type check on the L = ...  assignment
>
> In that particular case, a typecheck shouldn't be needed,
> since it would know that [...] always produces a builtin
> list object.

Of course :). Lots of things are known to be tuples, dicts, etc too.

- Robert




More information about the Pyrex mailing list