[Numpy-discussion] size_t or npy_intp?

Kurt Smith kwmsmith@gmail....
Tue Jul 27 10:27:21 CDT 2010


On Tue, Jul 27, 2010 at 10:17 AM, Dag Sverre Seljebotn
<dagss@student.matnat.uio.no> wrote:
>  From PEP 353:
>
>
>    Why not size_t56 <http://www.python.org/dev/peps/pep-0353/#id9>
>
> An initial attempt to implement this feature tried to use size_t. It
> quickly turned out that this cannot work: Python uses negative indices
> in many places (to indicate counting from the end). Even in places where
> size_t would be usable, too many reformulations of code where necessary,
> e.g. in loops like:
>
> for(index = length-1; index >= 0; index--)
>
> This loop will never terminate if index is changed from int to size_t.

Of course.  Makes sense; thanks for the clarification.

Kurt

>
>
> Dag Sverre


More information about the NumPy-Discussion mailing list