[Python-ideas] Fixing the Python 3 bytes constructor

Nick Coghlan ncoghlan at gmail.com
Thu Apr 3 22:04:07 CEST 2014


On 4 Apr 2014 05:03, "Serhiy Storchaka" <storchaka at gmail.com> wrote:
>
> 02.04.14 14:40, Nick Coghlan написав(ла):
>
>> I thought of that, but it seems like a recipe for typos and confusion.
>> bytes.byte and bytearray.byte seem clearer and safer.
>
>
> bytearray.byte looks deceptive. It returns not a byte, but 1-element
bytearray.
>
> I doubt that creating 1-element bytearray is enough often case to add new
special method (unlike to bytes.byte).

I actually agree, but Guido preferred the greater API consistency. Since
I'm only -0 on bytearray.byte, I don't have much motivation to argue about
it.

Cheers,
Nick.

>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140404/331d0297/attachment-0001.html>


More information about the Python-ideas mailing list