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-October/146671.html below:

[Python-Dev] Adding bytes.frombuffer() constructor to PEP 467 (was: [Python-ideas] Adding bytes.frombuffer() constructor

[Python-Dev] Adding bytes.frombuffer() constructor to PEP 467 (was: [Python-ideas] Adding bytes.frombuffer() constructor [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467 (was: [Python-ideas] Adding bytes.frombuffer() constructorSerhiy Storchaka storchaka at gmail.com
Wed Oct 12 01:32:30 EDT 2016
On 12.10.16 07:08, INADA Naoki wrote:
> Sample code:
>
>     def read_line(buf: bytearray) -> bytes:
>         try:
>             n = buf.index(b'\r\n')
>         except ValueError:
>             return b''
>
>         line = bytes(buf)[:n]  # bytearray -> bytes -> bytes

Wouldn't be more correct to write this as bytes(buf[:n])?

> Adding one more constructor to bytes:
>
>     # when length=-1 (default), use until end of *byteslike*.
>     bytes.frombuffer(byteslike, length=-1, offset=0)

This interface looks unusual. Would not be better to support the 
interface of buffer in Python 2: buffer(object [, offset[, size]])?


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