Re: [Numpy-discussion] Question about dtype

2014-12-26 Thread Valentin Haenel
Hi, * Sebastian se...@sebix.at [2014-12-13]: I'll just comment on the creation of your dtype: dt = [(f8, f8)] You are creating a dtype with one field called 'f8' and with type 'f8': dt = [(f8, f8)] dty = np.dtype(dt) dty.names ('f8',) What you may want are two fields with

Re: [Numpy-discussion] Question about dtype

2014-12-26 Thread Valentin Haenel
* Eelco Hoogendoorn hoogendoorn.ee...@gmail.com [2014-12-13]: This is a general problem in trying to use JSON to send arbitrary python objects. Its not made for that purpose, JSON itself only supports a very limited grammar (only one sequence type for instance, as you noticed), so in general

Re: [Numpy-discussion] Question about dtype

2014-12-26 Thread Valentin Haenel
* Nathaniel Smith n...@pobox.com [2014-12-13]: [snip] Ah, so your question is about how to serialize dtypes. The simplest approach would be to use pickle and shove the resulting string into your json. However, this is very dangerous if you need to process untrusted files, because if I can

Re: [Numpy-discussion] Question about dtype

2014-12-26 Thread Valentin Haenel
* Valentin Haenel valen...@haenel.co [2014-12-27]: * Nathaniel Smith n...@pobox.com [2014-12-13]: [snip] Ah, so your question is about how to serialize dtypes. The simplest approach would be to use pickle and shove the resulting string into your json. However, this is very dangerous if

Re: [Numpy-discussion] Question about dtype

2014-12-13 Thread Sebastian
Hi, I'll just comment on the creation of your dtype: dt = [(f8, f8)] You are creating a dtype with one field called 'f8' and with type 'f8': dt = [(f8, f8)] dty = np.dtype(dt) dty.names ('f8',) What you may want are two fields with type 'f8' and without fieldname: dt = [(f8, f8)] dty

Re: [Numpy-discussion] Question about dtype

2014-12-13 Thread Eelco Hoogendoorn
This is a general problem in trying to use JSON to send arbitrary python objects. Its not made for that purpose, JSON itself only supports a very limited grammar (only one sequence type for instance, as you noticed), so in general you will need to specify your own encoding/decoding for more

Re: [Numpy-discussion] Question about dtype

2014-12-12 Thread Valentin Haenel
Dear Nathaniel, thanks very much for your response. * Nathaniel Smith n...@pobox.com [2014-12-11]: On Wed, Dec 10, 2014 at 8:26 PM, Valentin Haenel valen...@haenel.co wrote: I am using numpy version 1.9.0 and Python 2.7.9 and have a question about the dtype: In [14]: np.dtype(f8)

Re: [Numpy-discussion] Question about dtype

2014-12-12 Thread Nathaniel Smith
On 12 Dec 2014 23:22, Valentin Haenel valen...@haenel.co wrote: Dear Nathaniel, thanks very much for your response. * Nathaniel Smith n...@pobox.com [2014-12-11]: On Wed, Dec 10, 2014 at 8:26 PM, Valentin Haenel valen...@haenel.co wrote: I am using numpy version 1.9.0 and Python 2.7.9

[Numpy-discussion] Question about dtype

2014-12-10 Thread Valentin Haenel
Hi, I am using numpy version 1.9.0 and Python 2.7.9 and have a question about the dtype: In [14]: np.dtype(f8) Out[14]: dtype('float64') In [15]: np.dtype(uf8) Out[15]: dtype('float64') In [16]: np.dtype([(f8, f8)]) Out[16]: dtype([('f8', 'f8')]) So far so good. Now what happens if I use

Re: [Numpy-discussion] Question about dtype

2014-12-10 Thread Nathaniel Smith
On Wed, Dec 10, 2014 at 8:26 PM, Valentin Haenel valen...@haenel.co wrote: Hi, I am using numpy version 1.9.0 and Python 2.7.9 and have a question about the dtype: In [14]: np.dtype(f8) Out[14]: dtype('float64') In [15]: np.dtype(uf8) Out[15]: dtype('float64') In [16]: np.dtype([(f8,