[Numpy-tickets] [NumPy] #333: Creating an array from a n-dim dtype type fails

NumPy numpy-tickets at scipy.net
Wed Oct 11 06:51:38 CDT 2006


#333: Creating an array from a n-dim dtype type fails
------------------------+---------------------------------------------------
 Reporter:  faltet      |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:          
Component:  numpy.core  |     Version:  devel   
 Severity:  normal      |    Keywords:          
------------------------+---------------------------------------------------
 The next exposes the problem:

 {{{
 In [142]:dt1=numpy.dtype('i4')
 In [143]:numpy.array(0, dtype=dt1.type)
 Out[143]:array(0)
 # good, but
 In [144]:dt2=numpy.dtype(('i4',(2,)))
 In [145]:numpy.array(0, dtype=dt2.type)
 ---------------------------------------------------------------------------
 exceptions.MemoryError                               Traceback (most
 recent call last)

 /home/faltet/python.nobackup/numpy/<ipython console>

 MemoryError:

 }}}

 Moreover:

 {{{
 In [147]:numpy.array([0], dtype=dt1.type)
 Out[147]:array([0])
 # good, but
 In [148]:numpy.array([0], dtype=dt2.type)
 ---------------------------------------------------------------------------
 exceptions.TypeError                                 Traceback (most
 recent call last)

 /home/faltet/python.nobackup/numpy/<ipython console>

 TypeError: expected a readable buffer object

 }}}

 I'd say that the .type is an scalar type that should be independent of the
 shape of the base dtype.

-- 
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/333>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list