Re: [Python-Dev] [Python-checkins] cpython (merge 3.2 -> default): Make TextIOWrapper's documentation clearer by copying the newline argument's

2012-08-04 Thread Victor Stinner
2012/8/4 Chris Jerdonek : > On Fri, Aug 3, 2012 at 3:59 PM, antoine.pitrou > wrote: >> http://hg.python.org/cpython/rev/f17a1410ebe5 >> changeset: 78401:f17a1410ebe5 >> summary: >> Make TextIOWrapper's documentation clearer by copying the newline >> argument's description from open(). > > Now

Re: [Python-Dev] Understanding the buffer API

2012-08-04 Thread Nick Coghlan
On Sun, Aug 5, 2012 at 2:41 AM, Stefan Krah wrote: > Nick Coghlan wrote: >> Think about trying to specify the buffer protocol using only C++ >> references rather than pointers. In Java, it's a lot easier to say >> "this value must be a reference to 'B'" than it is to say "this value >> must be NU

Re: [Python-Dev] Understanding the buffer API

2012-08-04 Thread Stefan Krah
Nick Coghlan wrote: > Think about trying to specify the buffer protocol using only C++ > references rather than pointers. In Java, it's a lot easier to say > "this value must be a reference to 'B'" than it is to say "this value > must be NULL". (My Java is a little rusty, but I'm still pretty sure

Re: [Python-Dev] Understanding the buffer API

2012-08-04 Thread Stefan Krah
Serhiy Storchaka wrote: > 4. The consumer has NOT requested writable buffer, can readonly flag > of provided buffer be false anyway? Yes, per the new documentation. This is not explicitly mentioned in the PEP but was existing practice and greatly simplifies several things: http://docs.python.org

Re: [Python-Dev] [Python-checkins] cpython (merge 3.2 -> default): Make TextIOWrapper's documentation clearer by copying the newline argument's

2012-08-04 Thread Chris Jerdonek
On Fri, Aug 3, 2012 at 3:59 PM, antoine.pitrou wrote: > http://hg.python.org/cpython/rev/f17a1410ebe5 > changeset: 78401:f17a1410ebe5 > summary: > Make TextIOWrapper's documentation clearer by copying the newline > argument's description from open(). Now that this change is made, it may make

Re: [Python-Dev] Understanding the buffer API

2012-08-04 Thread Stefan Krah
Nick Coghlan wrote: > I took Jeff's question as being slightly different and applying in the > following situations: I think I attempted to answer the same thing. :) > 1. If the consumer has NOT requested format data, can the provider > return accurate format data anyway, if that's easier than

Re: [Python-Dev] Understanding the buffer API

2012-08-04 Thread Nick Coghlan
On Sun, Aug 5, 2012 at 1:25 AM, Stefan Krah wrote: > In most cases it won't matter. However, a consumer is entitled to rely > on shape==NULL in response to a PyBUF_SIMPLE request. Perhaps there > is code that tests for shape==NULL to determine C-contiguity. > > This is an example that might occur

Re: [Python-Dev] Understanding the buffer API

2012-08-04 Thread Serhiy Storchaka
On 04.08.12 17:51, Nick Coghlan wrote: I took Jeff's question as being slightly different and applying in the following situations: 1. If the consumer has NOT requested format data, can the provider return accurate format data anyway, if that's easier than returning NULL but is consistent with d

Re: [Python-Dev] Understanding the buffer API

2012-08-04 Thread Stefan Krah
Jeff Allen wrote: > I still don't see why, if the consumer says "I'm assuming 1-D > unsigned bytes", and that's what the data is, memoryview_getbuf > could not provide a shape and strides that agree with the data. In most cases it won't matter. However, a consumer is entitled to rely on shape==NU

Re: [Python-Dev] Understanding the buffer API

2012-08-04 Thread Nick Coghlan
On Sat, Aug 4, 2012 at 7:11 PM, Stefan Krah wrote: > You are right that the PEP does not explicitly state that rule for > strides. However, NULL always has an implied meaning: > > format=NULL -> treat the buffer as unsigned bytes. > > shape=NULL -> one-dimensional AND treat the buffer as

Re: [Python-Dev] Understanding the buffer API

2012-08-04 Thread Jeff Allen
Thanks for a swift reply: you're just the person I hoped would do so. On 04/08/2012 10:11, Stefan Krah wrote: You are right that the PEP does not explicitly state that rule for strides. However, NULL always has an implied meaning: format=NULL -> treat the buffer as unsigned bytes. sha

Re: [Python-Dev] Understanding the buffer API

2012-08-04 Thread Stefan Krah
Jeff Allen wrote: > I'd like to lay a solid foundation that benefits from the > recent CPython work. I hope that some of the complexity in > memoryview stems from legacy considerations I don't have to deal > with in Jython. I'm afraid not: PEP-3118 is really that complex. ;) > My understanding