This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yselivanov
Recipients Yury.Selivanov, belopolsky, methane, ncoghlan, serhiy.storchaka, vstinner, yselivanov
Date 2017-01-06.17:13:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483722813.74.0.841750617729.issue29178@psf.upfronthosting.co.za>
In-reply-to
Content
> This is just a two-liner:
>
>    with memoryview(bytelike) as m:
>        bs = bytes(m[start:end])

Which virtually no one follows :(


> Adding new method to builtin type has high bar. I doubts that there are enough use cases in which bytes.frombuffer() has an advantage.

Any protocol parsing code has a lot of slicing.

> The signature of bytes.frombuffer() looks questionable. Why length and offset instead of start and stop indices as in slices? Why length is first and offset is last? This contradicts the interface of Python 2 buffer(), socket.sendfile(), os.sendfile(), etc.

I propose to make both arguments keyword-only.

> There is also a problem with returned type for subclasses (this is always a problem for alternate constructors).

Good point. How do we usually solve this in CPython?
History
Date User Action Args
2017-01-06 17:13:33yselivanovsetrecipients: + yselivanov, ncoghlan, belopolsky, vstinner, methane, Yury.Selivanov, serhiy.storchaka
2017-01-06 17:13:33yselivanovsetmessageid: <1483722813.74.0.841750617729.issue29178@psf.upfronthosting.co.za>
2017-01-06 17:13:33yselivanovlinkissue29178 messages
2017-01-06 17:13:33yselivanovcreate