A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-July/145637.html below:

[Python-Dev] PEP 467: Minor API improvements to bytes, bytearray, and memoryview

[Python-Dev] PEP 467: Minor API improvements to bytes, bytearray, and memoryviewEthan Furman ethan at stoneleaf.us
Mon Jul 18 15:58:17 EDT 2016
On 06/07/2016 02:34 PM, Koos Zevenhoven wrote:

> Why not bytes.viewbytes (or whatever name) so that one could also
> subscript it? And if it were a property, one could perhaps
> conveniently get the n'th byte:
>
> b'abcde'.viewbytes[n]   # compared to b'abcde'[n:n+1]

AFAICT, 'viewbytes' doesn't add much over bytes itself if we add a 'getbyte' method.

> Also, would it not be more clear to call the int -> bytes method
> something like bytes.fromint or bytes.fromord and introduce the same
> thing on str? And perhaps allow multiple arguments to create a
> str/bytes of length > 1. I guess this may violate TOOWTDI, but anyway,
> just a thought.

Yes, it would.  Changing to 'bytes.fromint'.

--
~Ethan~
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4