[Numpy-discussion] Behaviour of copy for structured dtypes with gaps

2019-04-11 Thread Marten van Kerkwijk
Hi All, An issue [1] about the copying of arrays with structured dtype raised a question about what the expected behaviour is: does copy always preserve the dtype as is, or should it remove padding? Specifically, consider an array with a structure with many fields, say 'a' to 'z'. Since numpy 1.1

Re: [Numpy-discussion] adding Quansight Labs as institutional partner

2019-04-11 Thread Ralf Gommers
On Tue, Apr 9, 2019 at 6:25 PM Ralf Gommers wrote: > > > Thanks Alan, good questions. The donations via the Flipcause site go to > NumFOCUS. NumFOCUS is a 501(c)3 and NumPy's fiscal sponsor, so any > individual or institution that wants to donate to NumPy should preferably > donate to NumFOCUS. T

Re: [Numpy-discussion] Behaviour of copy for structured dtypes with gaps

2019-04-11 Thread Stefan van der Walt
Hi Marten, On Thu, 11 Apr 2019 09:51:10 -0400, Marten van Kerkwijk wrote: > From the discussion so far, it > seems the logic has boiled down to a choice between: > > (1) Copy is a contract that the dtype will not vary (e.g., we also do not > change endianness); > > (2) Copy is a contract that an

Re: [Numpy-discussion] Behaviour of copy for structured dtypes with gaps

2019-04-11 Thread Travis Oliphant
I agree with Stefan that option 2 is what NumPy should go with for .copy() If you want to get an identical memory copy you should be getting the .data attribute and doing something with that buffer. My $0.02 -Travis On Thu, Apr 11, 2019 at 6:01 PM Stefan van der Walt wrote: > Hi Marten, > >

Re: [Numpy-discussion] Behaviour of copy for structured dtypes with gaps

2019-04-11 Thread Nathaniel Smith
My concern would be that to implement (2), I think .copy() has to either special-case certain dtypes, or else we have to add some kind of "simplify for copy" operation to the dtype protocol. These both add architectural complexity, so maybe it's better to avoid it unless we have a compelling reason