[Python-3000] PyBuffer ndim unsigned

Gregory P. Smith greg at krypto.org
Sun Aug 26 05:02:08 CEST 2007


heh good point.  ignore that thought.  python is a signed language.  :)

On 8/25/07, Guido van Rossum <guido at python.org> wrote:
> I look at it from another POV -- does anyone care about not being able
> to represent dimensionalities over 2 billion? I don't see the
> advantage of saying unsigned int here; it just means that we'll get
> more compiler warnings in code that is otherwise fine. After all, the
> previous line says 'int readonly' -- I'm sure that's meant to be a
> bool as well. Hey, Python sequences use Py_ssize_t to express their
> length, and I've never seen a string with a negative length either.
> :-)
>
> I could even see code computing the difference between two dimensions
> and checking if it is negative; don't some compilers actively work
> against making such code work correctly?
>
> --Guido
>
> On 8/25/07, Gregory P. Smith <greg at krypto.org> wrote:
> > Anyone mind if I do this?
> >
> > --- Include/object.h    (revision 57412)
> > +++ Include/object.h    (working copy)
> > @@ -148,7 +148,7 @@
> >          Py_ssize_t itemsize;  /* This is Py_ssize_t so it can be
> >                                   pointed to by strides in simple case.*/
> >          int readonly;
> > -        int ndim;
> > +        unsigned int ndim;
> >          char *format;
> >          Py_ssize_t *shape;
> >          Py_ssize_t *strides;
> >
> >
> > PEP 3118 and all reality as I know it says ndim must be >= 0 so it
> > makes sense to me.
> > _______________________________________________
> > Python-3000 mailing list
> > Python-3000 at python.org
> > http://mail.python.org/mailman/listinfo/python-3000
> > Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
> >
>
>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/)
>


More information about the Python-3000 mailing list