[Python-3000] PEP 3137 plan of attack

Gregory P. Smith greg at krypto.org
Thu Oct 11 10:09:31 CEST 2007


On 10/11/07, Gregory P. Smith <greg at krypto.org> wrote:
>
> Guido -
>
> One tiny question has come up while working on this one:
>
> Should the PyBytes buffer (mutable bytes) object's .append(val) and
> .remove(val) methods accept anything other than an int in the 0..255 range?
>
> I believe the answer to be no based on the previous long thread on this
> but these two weren't mentioned at the time so i figure I'll ask.  Should a
> pep3118 buffer api supporting object that produces a length 1 buffer also
> work for append and remove?  That would allow .append(b'!') or
> .remove(b'!').


I'm doubly assuming 'no' now as the .insert() method would also need it for
consistancy which just be plain gross to allow .insert(5, b'x') to work but
.insert(5, b'xyz') to fail with a ValueError.  Consider the question unasked
unless you want a different answer.

amusingly right now in 3.0a1 there is a bug where .append('33') will happily
> append a b'!' by converting it into an int then into a byte.  regardless of
> the answer that misbehavior will be zapped in the patch i'm about to submit.
> ;)
>
> -gps
>
> On 10/8/07, Gregory P. Smith <greg at krypto.org> wrote:
> >
> >
> > - add missing methods to PyBytes (for list, see the PEP and compare to
> > > what's already there)
> > >
> > >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20071011/2e89e471/attachment-0001.htm 


More information about the Python-3000 mailing list