Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-16 Thread Travis Oliphant
Thomas Heller wrote: > Robert Kern wrote: > >> Francesc Altet wrote: >> >>> A Divendres 09 Juny 2006 11:54, Albert Strasheim va escriure: >>> >>> Just out of curiosity: In [1]: x = N.array([]) In [2]: x.__array_data__ Out[2]: ('0x01C23EE0', False) >

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-16 Thread Francesc Altet
A Divendres 16 Juny 2006 21:25, Thomas Heller va escriure: > Robert Kern wrote: > > Like how Win64 uses 32-bit longs and 64-bit pointers. And then there's > > signedness. Please don't use Python ints to encode pointers. Holding > > arbitrary pointers is the job of CObjects. > > (Sorry, I'm late in

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-16 Thread Thomas Heller
Robert Kern wrote: > Francesc Altet wrote: >> A Divendres 09 Juny 2006 11:54, Albert Strasheim va escriure: >> >>>Just out of curiosity: >>> >>>In [1]: x = N.array([]) >>> >>>In [2]: x.__array_data__ >>>Out[2]: ('0x01C23EE0', False) >>> >>>Is there a reason why the __array_data__ tuple stores the

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-10 Thread Andrew Straw
OK, here's another (semi-crazy) idea: __array_struct__ is the interface. ctypes lets us use it in "pure" Python. We provide a "reference implementation" so that newbies don't get segfaults. ___ Numpy-discussion mailing list Numpy-discussion@lists.sou

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Tim Hochberg
David M. Cooke wrote: >On Fri, 09 Jun 2006 16:03:32 -0700 >Andrew Straw <[EMAIL PROTECTED]> wrote: > > > >>Tim Hochberg wrote: >> >> >> >>>Which of the following should we require for an object to be "supporting >>>the array interface"? Here a producer is something that supplies >>>array_s

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread David M. Cooke
On Fri, 09 Jun 2006 16:03:32 -0700 Andrew Straw <[EMAIL PROTECTED]> wrote: > Tim Hochberg wrote: > > >Which of the following should we require for an object to be "supporting > >the array interface"? Here a producer is something that supplies > >array_struct or array_interface (where the latter

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Andrew Straw
Tim Hochberg wrote: >Which of the following should we require for an object to be "supporting >the array interface"? Here a producer is something that supplies >array_struct or array_interface (where the latter is the Python level >version of the former as per recent messages). Consumers do som

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Tim Hochberg
Which of the following should we require for an object to be "supporting the array interface"? Here a producer is something that supplies array_struct or array_interface (where the latter is the Python level version of the former as per recent messages). Consumers do something with the results

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Tim Hochberg
Travis Oliphant wrote: >Tim Hochberg wrote: > > > >>I was going to say that it may help to think of array_interface as >>returning a *view*, since that seems to be the semantics that could >>probably be implemented safely without too much trouble. However, it >>looks like that's not what happ

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread David M. Cooke
On Fri, 09 Jun 2006 12:08:51 -0600 Travis Oliphant <[EMAIL PROTECTED]> wrote: > Tim Hochberg wrote: > > > Sasha wrote: > > > >> On 6/8/06, David M. Cooke <[EMAIL PROTECTED]> wrote: > > >>> > >> > >> My problem with __array_struct__ returning either a tuple or a CObject > >> is that array prot

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Andrew Straw
Travis Oliphant wrote: > Andrew Straw wrote: > >> On the one hand, I feel we should keep __array_struct__ behaving >> exactly as it is now. There's already lots of code that uses it, and >> it's tremendously useful despite (because of?) it's simplicity. For >> these of use cases, the __array_de

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Travis Oliphant
Tim Hochberg wrote: >I was going to say that it may help to think of array_interface as >returning a *view*, since that seems to be the semantics that could >probably be implemented safely without too much trouble. However, it >looks like that's not what happens. array_interface->shape and stri

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Tim Hochberg
Sasha wrote: >On 6/9/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > >>... In NumPy this is not quite the rule followed. >>Bascially attributes are used when getting or setting intrinsinc >>"properties" of the array. Attributes are used for properties that are >>important in defining what

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Andrew Straw
On the one hand, I feel we should keep __array_struct__ behaving exactly as it is now. There's already lots of code that uses it, and it's tremendously useful despite (because of?) it's simplicity. For these of use cases, the __array_descr__ information has already proven unnecessary. I must sa

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Sasha
On 6/9/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > ... In NumPy this is not quite the rule followed. > Bascially attributes are used when getting or setting intrinsinc > "properties" of the array. Attributes are used for properties that are > important in defining what an array *is*. The

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Alexander Belopolsky
On 6/9/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > ... In NumPy this is not quite the rule followed. > Bascially attributes are used when getting or setting intrinsinc > "properties" of the array. Attributes are used for properties that are > important in defining what an array *is*. The

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Travis Oliphant
Tim Hochberg wrote: > Sasha wrote: > >> On 6/8/06, David M. Cooke <[EMAIL PROTECTED]> wrote: >> >> >>> ... >>> +0 for name change; I'm happy with it as an attribute. >>> >>> >> >> My rule of thumb for choosing between an attribute and a method is >> that attribute access should not create new

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Tim Hochberg
Sasha wrote: >On 6/9/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > > >>Sasha wrote: >>... >> >> >>>My rule of thumb for choosing between an attribute and a method is >>>that attribute access should not create new objects. >>> >>> >>> >>Conceptually at least, couldn't there be a single

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Travis Oliphant
Albert Strasheim wrote: >Hello all > > > >>-Original Message- >>From: [EMAIL PROTECTED] [mailto:numpy- >>[EMAIL PROTECTED] On Behalf Of Travis Oliphant >>Sent: 08 June 2006 22:27 >>To: numpy-discussion >>Subject: [Numpy-discussion] Arra

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Sasha
On 6/9/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > Shouldn't pure python implementations > just provide __array__? > You cannot implement __array__ without importing numpy. ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Sasha
On 6/9/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > Sasha wrote: > ... > >> > >My rule of thumb for choosing between an attribute and a method is > >that attribute access should not create new objects. > > > Conceptually at least, couldn't there be a single __array_interface__ > object associated

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Robert Kern
Francesc Altet wrote: > A Divendres 09 Juny 2006 11:54, Albert Strasheim va escriure: > >>Just out of curiosity: >> >>In [1]: x = N.array([]) >> >>In [2]: x.__array_data__ >>Out[2]: ('0x01C23EE0', False) >> >>Is there a reason why the __array_data__ tuple stores the address as a hex >>string? I wo

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Tim Hochberg
Sasha wrote: >On 6/8/06, David M. Cooke <[EMAIL PROTECTED]> wrote: > > >>... >>+0 for name change; I'm happy with it as an attribute. >> >> >> >My rule of thumb for choosing between an attribute and a method is >that attribute access should not create new objects. > Conceptually at least, co

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Francesc Altet
A Divendres 09 Juny 2006 11:54, Albert Strasheim va escriure: > Just out of curiosity: > > In [1]: x = N.array([]) > > In [2]: x.__array_data__ > Out[2]: ('0x01C23EE0', False) > > Is there a reason why the __array_data__ tuple stores the address as a hex > string? I would guess that this representa

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-09 Thread Albert Strasheim
Hello all > -Original Message- > From: [EMAIL PROTECTED] [mailto:numpy- > [EMAIL PROTECTED] On Behalf Of Travis Oliphant > Sent: 08 June 2006 22:27 > To: numpy-discussion > Subject: [Numpy-discussion] Array Protocol change for Python 2.6 > > ... > > I w

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-08 Thread Sasha
On 6/8/06, David M. Cooke <[EMAIL PROTECTED]> wrote: > ... > +0 for name change; I'm happy with it as an attribute. > My rule of thumb for choosing between an attribute and a method is that attribute access should not create new objects. In addition, to me __array_interface__ feels like a generali

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-08 Thread Tim Hochberg
Sasha wrote: >On 6/8/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > >>... >>__array_struct__ (perhaps we could call this __array_interface__ but >>I'm happy keeping the name the same too.) >> >> > >+0 on the name change and consider making it a method rather than an attribute. > > I'

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-08 Thread David M. Cooke
On Thu, 8 Jun 2006 17:07:55 -0400 Sasha <[EMAIL PROTECTED]> wrote: > On 6/8/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > ... > > __array_struct__ (perhaps we could call this __array_interface__ but > > I'm happy keeping the name the same too.) > > +0 on the name change and consider making

Re: [Numpy-discussion] Array Protocol change for Python 2.6

2006-06-08 Thread Sasha
On 6/8/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > ... > __array_struct__ (perhaps we could call this __array_interface__ but > I'm happy keeping the name the same too.) +0 on the name change and consider making it a method rather than an attribute. > > If __array_struct__ is a CObject the

[Numpy-discussion] Array Protocol change for Python 2.6

2006-06-08 Thread Travis Oliphant
One of the hopes for the Summer of Code project involving getting the multidimensional array object into Python 2.6 is advertisement of the array protocol or array interface. I think one way to simplify the array protocol is simply have only one attribute that is looked to to provide access to