Re: [Python-Dev] bytes-like objects

2014-10-07 Thread Nick Coghlan
On 7 Oct 2014 00:31, "Christian Tismer" wrote: > > 2) > And about this glossary entry: > > "An object that supports the Buffer Protocol" > - can I take that for granted, as a real definition, meaning > > """an object is bytes-like iff it supports the buffer protocol"""? Yes, although we should l

Re: [Python-Dev] bytes-like objects

2014-10-06 Thread Christian Tismer
On 06/10/14 10:33, Georg Brandl wrote: > bytes-like object Howdy, two small comments: 1) just as a quick check, I did a Python search for exactly that phrase https://docs.python.org/3/search.html?q=bytes-like+object&check_keywords=yes&area=default with zero results. Maybe it would be a good t

Re: [Python-Dev] bytes-like objects

2014-10-06 Thread Georg Brandl
On 10/06/2014 06:34 AM, Nick Coghlan wrote: > 3. "buffer" is a completely new term for most users, and one that > refers to an implementation detail of memoryview, moreso than > something developers actually need to care about. Using it directly in > error messages and documentation is to make the

Re: [Python-Dev] bytes-like objects

2014-10-05 Thread Nick Coghlan
On 6 October 2014 10:15, Greg Ewing wrote: > I wrote: > >>> But you can't >>> create an object that supports the buffer protocol by implementing >>> Python methods. > > > Another thing is that an object implementing the buffer > interface doesn't have to look anything at all like a > bytes object

Re: [Python-Dev] bytes-like objects

2014-10-05 Thread Nick Coghlan
On 6 October 2014 07:24, Greg Ewing wrote: > anatoly techtonik wrote: >> >> That's a cool stuff. `bytes-like object` is really a much better name for >> users. > > > I'm not so sure. Usually when we talk about an "xxx-like object" we > mean one that supports a certain Python interface, e.g. a "fil

Re: [Python-Dev] bytes-like objects

2014-10-05 Thread Greg Ewing
I wrote: But you can't create an object that supports the buffer protocol by implementing Python methods. Another thing is that an object implementing the buffer interface doesn't have to look anything at all like a bytes object from Python, so calling it "bytes-like" could be rather confusing

Re: [Python-Dev] bytes-like objects

2014-10-05 Thread Nick Coghlan
On 6 October 2014 07:32, Victor Stinner wrote: > Hi, > > I prefer "bytes-like" than "buffer protocol". By the way, is there a > documentation in Python doc which explains "bytes-like" and maybe list most > compatible types? https://docs.python.org/3/glossary.html#term-bytes-like-object It only s

Re: [Python-Dev] bytes-like objects

2014-10-05 Thread David Wilson
On Sun, Oct 05, 2014 at 11:32:08PM +0200, Victor Stinner wrote: > I'm not sure that the term has an unique definition. In some parts of > Python, I saw explicit checks on the type: bytes or bytearray, > sometimes memoryview is accepted. The behaviour is different in C > functions using PyArg API.

Re: [Python-Dev] bytes-like objects

2014-10-05 Thread Serhiy Storchaka
On 06.10.14 00:24, Greg Ewing wrote: anatoly techtonik wrote: That's a cool stuff. `bytes-like object` is really a much better name for users. I'm not so sure. Usually when we talk about an "xxx-like object" we mean one that supports a certain Python interface, e.g. a "file-like object" is one

Re: [Python-Dev] bytes-like objects

2014-10-05 Thread Victor Stinner
Hi, I prefer "bytes-like" than "buffer protocol". By the way, is there a documentation in Python doc which explains "bytes-like" and maybe list most compatible types? I'm not sure that the term has an unique definition. In some parts of Python, I saw explicit checks on the type: bytes or bytearra

Re: [Python-Dev] bytes-like objects

2014-10-05 Thread Greg Ewing
anatoly techtonik wrote: That's a cool stuff. `bytes-like object` is really a much better name for users. I'm not so sure. Usually when we talk about an "xxx-like object" we mean one that supports a certain Python interface, e.g. a "file-like object" is one that has read() and/or write() method

Re: [Python-Dev] bytes-like objects

2014-10-05 Thread anatoly techtonik
That's a cool stuff. `bytes-like object` is really a much better name for users. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive

Re: [Python-Dev] bytes-like objects

2014-10-05 Thread Georg Brandl
On 10/05/2014 06:11 PM, R. David Murray wrote: > Over the past while we've been cleaning up the docs in the area of "how > do we refer to bytes, bytearray, memoryview, etc, etc?" in the APIs that > deal with bytes. As you may or may not remember, we settled on the term > 'bytes-like object', and h

[Python-Dev] bytes-like objects

2014-10-05 Thread R. David Murray
Over the past while we've been cleaning up the docs in the area of "how do we refer to bytes, bytearray, memoryview, etc, etc?" in the APIs that deal with bytes. As you may or may not remember, we settled on the term 'bytes-like object', and have changed the docs to (we hope) consistently use this