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

Robert Bradshaw robertwb at math.washington.edu
Wed Nov 28 07:25:44 CET 2007


On Nov 27, 2007, at 10:12 PM, Greg Ewing wrote:

> Robert Bradshaw wrote:
>> I was thinking that if something were declared as "cdef list"  
>> then  only exactly list objects (or None) could be assigned to it
>
> That would be inconsistent with the way types
> generally work in Pyrex.

True. But otherwise, what's to be gained? Python builtins would be a  
special kind of declared type and could still be very useful.

Another alternative is to try and coerce to a list, but this could be  
bad memory and time-wise. If I declare a variable as a list, I'd  
rather have it throw a type error if it isn't one (and, for  
efficiency reasons, if it isn't one exactly there's not much gain).

- Robert




More information about the Pyrex mailing list