[Numpy-tickets] [NumPy] #902: inconsistent float to string conversion with german locale

NumPy numpy-tickets@scipy....
Mon Sep 15 11:44:12 CDT 2008

#902: inconsistent  float to string conversion with german locale
 Reporter:  ChristianK                  |        Owner:  somebody
     Type:  defect                      |       Status:  new     
 Priority:  normal                      |    Milestone:  1.2.0   
Component:  numpy.core                  |      Version:  1.1.1   
 Severity:  major                       |   Resolution:          
 Keywords:  locale repr floating point  |  
Comment (by AchimGaedke):

 An advanced example, revealing more trouble by German locale in connection
 with gtk.

 Consider this python program (saved as locale_trouble.py):
 import numpy
 print a, float(a)
 import gtk
 print a, float(a)

 everything is fine, if you call this program as follows:
 LANG="C" python locale_trouble.py
 1.2 1.20000004768
 1.2 1.20000004768

 LANG="de_DE" python locale_trouble.py
 1.2 1.20000004768
 1,2 1.20000004768

 The coma in the last line is unexpected.

 This error also occurs when using pylab or matplotlib with gtk backend:
 import pylab
 print pylab.rcParams["backend"]
 This behaviour is observed with debian lenny and python 2.4 and python
 2.5,  numpy-1.1.0 and numpy-1.1.1 . On debian etch with numpy-1.0.1 we
 were not able to provoke a coma.

 The inconsitency is highly irritating, so we believe that is a bug.
 Following the python policy to use a dot for numbers, independent of
 locale definitions, also numpy should use dots. See note (3) on page:

Ticket URL: <http://scipy.org/scipy/numpy/ticket/902#comment:1>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list