[Numpy-tickets] [NumPy] #756: String conversion should be supported for arithmetic operators.

NumPy numpy-tickets@scipy....
Thu Apr 24 22:49:09 CDT 2008


#756: String conversion should be supported for arithmetic operators.
------------------------+---------------------------------------------------
 Reporter:  charris     |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:  1.2     
Component:  numpy.core  |     Version:  none    
 Severity:  normal      |    Keywords:          
------------------------+---------------------------------------------------
 Here is the problem:

 In [1]: a = ones(3)

 In [2]: a + '1'
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)

 /home/charris/<ipython console> in <module>()

 TypeError: unsupported operand type(s) for +: 'numpy.ndarray' and 'str'

 I think the general rule for combining strings with any numeric type
 should be casting the string. The casting now works in numby, we just need
 to finish making it work with everything else.

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


More information about the Numpy-tickets mailing list