Re: [Python-Dev] PEP 467: last round (?)

2016-09-10 Thread Serhiy Storchaka
On 01.09.16 22:36, Ethan Furman wrote: * Add ``bytes.iterbytes`` and ``bytearray.iterbytes`` alternative iterators Could you please add a mention of alternative: seqtools.chunks()? seqtools.chunks(bytes, 1) and seqtools.chunks(bytearray, 1) should be equivalent to bytes.iterbytes() and bytear

Re: [Python-Dev] PEP 467: last round (?)

2016-09-06 Thread Koos Zevenhoven
On Mon, Sep 5, 2016 at 6:06 AM, Nick Coghlan wrote: > On 5 September 2016 at 06:42, Koos Zevenhoven wrote: >> On Sun, Sep 4, 2016 at 6:38 PM, Nick Coghlan wrote: >>> >>> There are two self-consistent sets of names: >>> >> >> Let me add a few. I wonder if this is really used so much that >> bytes

Re: [Python-Dev] PEP 467: last round (?)

2016-09-06 Thread Koos Zevenhoven
On Mon, Sep 5, 2016 at 3:30 AM, Random832 wrote: > On Sun, Sep 4, 2016, at 16:42, Koos Zevenhoven wrote: >> On Sun, Sep 4, 2016 at 6:38 PM, Nick Coghlan wrote: >> > >> > There are two self-consistent sets of names: >> > >> >> Let me add a few. I wonder if this is really used so much that >> bytes

Re: [Python-Dev] PEP 467: last round (?)

2016-09-05 Thread Ethan Furman
On 09/03/2016 09:48 AM, Nick Coghlan wrote: On 3 September 2016 at 21:35, Martin Panter wrote: On 3 September 2016 at 08:47, Victor Stinner wrote: Le samedi 3 septembre 2016, Random832 a écrit : On Fri, Sep 2, 2016, at 19:44, Ethan Furman wrote: The problem with only having `bchr` is that i

Re: [Python-Dev] PEP 467: last round (?)

2016-09-04 Thread Nick Coghlan
On 5 September 2016 at 06:42, Koos Zevenhoven wrote: > On Sun, Sep 4, 2016 at 6:38 PM, Nick Coghlan wrote: >> >> There are two self-consistent sets of names: >> > > Let me add a few. I wonder if this is really used so much that > bytes.chr is too long to type (and you can do bchr = bytes.chr if y

Re: [Python-Dev] PEP 467: last round (?)

2016-09-04 Thread Random832
On Sun, Sep 4, 2016, at 16:42, Koos Zevenhoven wrote: > On Sun, Sep 4, 2016 at 6:38 PM, Nick Coghlan wrote: > > > > There are two self-consistent sets of names: > > > > Let me add a few. I wonder if this is really used so much that > bytes.chr is too long to type (and you can do bchr = bytes.chr

Re: [Python-Dev] PEP 467: last round (?)

2016-09-04 Thread Koos Zevenhoven
On Sun, Sep 4, 2016 at 6:38 PM, Nick Coghlan wrote: > > There are two self-consistent sets of names: > Let me add a few. I wonder if this is really used so much that bytes.chr is too long to type (and you can do bchr = bytes.chr if you want to): bytes.chr (or bchr in builtins) bytes.chr_at, byte

Re: [Python-Dev] PEP 467: last round (?)

2016-09-04 Thread Nick Coghlan
On 4 September 2016 at 20:43, Koos Zevenhoven wrote: > On Sun, Sep 4, 2016 at 12:51 PM, Nick Coghlan wrote: >> That said, the PEP does propose "getbyte()" and "iterbytes()" for >> bytes-oriented indexing and iteration, so there's a reasonable >> consistency argument in favour of also proposing "b

Re: [Python-Dev] PEP 467: last round (?)

2016-09-04 Thread Koos Zevenhoven
On Sun, Sep 4, 2016 at 12:51 PM, Nick Coghlan wrote: > On 4 September 2016 at 08:11, Random832 wrote: >> On Sat, Sep 3, 2016, at 18:06, Koos Zevenhoven wrote: >>> I guess one reason I don't like bchr (nor chrb, really) is that they >>> look just like a random sequence of letters in builtins, but

Re: [Python-Dev] PEP 467: last round (?)

2016-09-04 Thread Nick Coghlan
On 4 September 2016 at 08:11, Random832 wrote: > On Sat, Sep 3, 2016, at 18:06, Koos Zevenhoven wrote: >> I guess one reason I don't like bchr (nor chrb, really) is that they >> look just like a random sequence of letters in builtins, but not >> recognizable the way asdf would be. >> >> I guess I

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Koos Zevenhoven
On Sun, Sep 4, 2016 at 1:23 AM, Ivan Levkivskyi wrote: > On 4 September 2016 at 00:11, Random832 wrote: >> >> On Sat, Sep 3, 2016, at 18:06, Koos Zevenhoven wrote: >> > I guess one reason I don't like bchr (nor chrb, really) is that they >> > look just like a random sequence of letters in builtin

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Ivan Levkivskyi
On 4 September 2016 at 00:11, Random832 wrote: > On Sat, Sep 3, 2016, at 18:06, Koos Zevenhoven wrote: > > I guess one reason I don't like bchr (nor chrb, really) is that they > > look just like a random sequence of letters in builtins, but not > > recognizable the way asdf would be. > > > > I gu

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Koos Zevenhoven
On Sat, Sep 3, 2016 at 6:41 PM, Ethan Furman wrote: >>> >>> Open Questions >>> == >>> >>> Do we add ``iterbytes`` to ``memoryview``, or modify >>> ``memoryview.cast()`` to accept ``'s'`` as a single-byte interpretation? >>> Or >>> do we ignore memory for now and add it later? >> >> >>

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Random832
On Sat, Sep 3, 2016, at 18:06, Koos Zevenhoven wrote: > I guess one reason I don't like bchr (nor chrb, really) is that they > look just like a random sequence of letters in builtins, but not > recognizable the way asdf would be. > > I guess I have one last pair of suggestions for the name of this

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Random832
On Sat, Sep 3, 2016, at 08:08, Martin Panter wrote: > On 1 September 2016 at 19:36, Ethan Furman wrote: > > Deprecation of current "zero-initialised sequence" behaviour without removal > > > > > > Currently, the ``bytes

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Koos Zevenhoven
On Sat, Sep 3, 2016 at 7:59 PM, Nick Coghlan wrote: > On 3 September 2016 at 03:54, Koos Zevenhoven wrote: >> chrb seems to be more in line with some bytes versions in for instance os >> than bchr. > > The mnemonic for the current name in the PEP is that bchr is to chr as > b"" is to "". The PEP

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Nick Coghlan
On 3 September 2016 at 03:54, Koos Zevenhoven wrote: > chrb seems to be more in line with some bytes versions in for instance os > than bchr. The mnemonic for the current name in the PEP is that bchr is to chr as b"" is to "". The PEP should probably say that in addition to pointing out the 'unic

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Nick Coghlan
On 3 September 2016 at 21:35, Martin Panter wrote: >> Le samedi 3 septembre 2016, Random832 a écrit : >>> On Fri, Sep 2, 2016, at 19:44, Ethan Furman wrote: >>> > The problem with only having `bchr` is that it doesn't help with >>> > `bytearray`; >>> >>> What is the use case for bytearray.fromord

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Ethan Furman
On 09/02/2016 06:17 PM, Greg Ewing wrote: Ethan Furman wrote: The problem with only having `bchr` is that it doesn't help with `bytearray`; the problem with not having `bchr` is who wants to write `bytes.fromord`? If we called it 'bytes.fnord' (From Numeric Ordinal) people would want to wr

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Ethan Furman
On 09/03/2016 05:08 AM, Martin Panter wrote: On 1 September 2016 at 19:36, Ethan Furman wrote: Deprecation of current "zero-initialised sequence" behaviour without removal Currently, the ``bytes`` and ``bytearray`` c

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Martin Panter
On 1 September 2016 at 19:36, Ethan Furman wrote: > Deprecation of current "zero-initialised sequence" behaviour without removal > > > Currently, the ``bytes`` and ``bytearray`` constructors accept an integer > argument a

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Martin Panter
> Le samedi 3 septembre 2016, Random832 a écrit : >> On Fri, Sep 2, 2016, at 19:44, Ethan Furman wrote: >> > The problem with only having `bchr` is that it doesn't help with >> > `bytearray`; >> >> What is the use case for bytearray.fromord? Even in the rare case >> someone needs it, why not bytea

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Martin Panter
On 2 September 2016 at 17:54, Koos Zevenhoven wrote: > On Thu, Sep 1, 2016 at 10:36 PM, Ethan Furman wrote: >> * Deprecate passing single integer values to ``bytes`` and ``bytearray`` >> * Add ``bytes.fromsize`` and ``bytearray.fromsize`` alternative >> constructors >> * Add ``bytes.fromord`` and

Re: [Python-Dev] PEP 467: last round (?)

2016-09-03 Thread Victor Stinner
Yes, this was my point: I don't think that we need a bytearray method to create a mutable string from a single byte. Victor Le samedi 3 septembre 2016, Random832 a écrit : > On Fri, Sep 2, 2016, at 19:44, Ethan Furman wrote: > > The problem with only having `bchr` is that it doesn't help with >

Re: [Python-Dev] PEP 467: last round (?)

2016-09-02 Thread Greg Ewing
Ethan Furman wrote: The problem with only having `bchr` is that it doesn't help with `bytearray`; the problem with not having `bchr` is who wants to write `bytes.fromord`? If we called it 'bytes.fnord' (From Numeric Ordinal) people would want to write it just for the fun factor. -- Greg _

Re: [Python-Dev] PEP 467: last round (?)

2016-09-02 Thread Random832
On Fri, Sep 2, 2016, at 19:44, Ethan Furman wrote: > The problem with only having `bchr` is that it doesn't help with > `bytearray`; What is the use case for bytearray.fromord? Even in the rare case someone needs it, why not bytearray(bchr(...))? ___ Pyt

Re: [Python-Dev] PEP 467: last round (?)

2016-09-02 Thread Ethan Furman
On 09/01/2016 04:07 PM, Victor Stinner wrote: 2016-09-02 0:04 GMT+02:00 Ethan Furman: - `fromord` to replace the mistaken purpose of the default constructor To replace a bogus bytes(obj)? If someone writes bytes(obj) but expect to create a byte string from an integer, why not using bchr() to

Re: [Python-Dev] PEP 467: last round (?)

2016-09-02 Thread Koos Zevenhoven
Some quick comments below, a few more later: On Thu, Sep 1, 2016 at 10:36 PM, Ethan Furman wrote: > One more iteration. PEPs repo not updated yet. Changes are renaming of > methods to be ``fromsize()`` and ``fromord()``, and moving ``memoryview`` to > an Open Questions section. > > > PEP: 467 > T

Re: [Python-Dev] PEP 467: last round (?)

2016-09-01 Thread Victor Stinner
2016-09-02 0:04 GMT+02:00 Ethan Furman : > - `fromord` to replace the mistaken purpose of the default constructor To replace a bogus bytes(obj)? If someone writes bytes(obj) but expect to create a byte string from an integer, why not using bchr() to fix the code? Victor __

Re: [Python-Dev] PEP 467: last round (?)

2016-09-01 Thread Ethan Furman
On 09/01/2016 02:06 PM, Victor Stinner wrote: 2016-09-01 21:36 GMT+02:00 Ethan Furman: Abstract This PEP proposes five small adjustments to the APIs of the ``bytes`` and ``bytearray`` types to make it easier to operate entirely in the binary domain: You should add bchr() in the Abs

Re: [Python-Dev] PEP 467: last round (?)

2016-09-01 Thread Victor Stinner
2016-09-01 21:36 GMT+02:00 Ethan Furman : > Abstract > > > This PEP proposes five small adjustments to the APIs of the ``bytes`` and > ``bytearray`` types to make it easier to operate entirely in the binary > domain: You should add bchr() in the Abstract. > * Deprecate passing single in

[Python-Dev] PEP 467: last round (?)

2016-09-01 Thread Ethan Furman
One more iteration. PEPs repo not updated yet. Changes are renaming of methods to be ``fromsize()`` and ``fromord()``, and moving ``memoryview`` to an Open Questions section. PEP: 467 Title: Minor API improvements for binary sequences Version: $Revision$ Last-Modified: $Date$ Author: Nick Co