GTK breaks float! (related to "float does not parse 0.00000E+00")

Thomas Wouters thomas at xs4all.net
Tue Jun 6 09:50:07 EDT 2000


On Mon, Jun 05, 2000 at 04:52:52PM +0200, Paolo Redaelli wrote:
> Look at the this short program:

> =======
> #!/usr/bin/env python
> 
> s = "0.000000E+00"
> print "Converting",s," into: ", float(s)
> print "Importing gtk"
> 
> import GDK
> from gtk import *
> from gnome.ui import *

> import GdkImlib
> print "Converting",s," into: ", float(s)
> =======
> Here's its output:
> =======
> [paolo at aldebaran paolo]$ python float.py
> Converting 0.000000E+00  into:  0.0
> Importing gtk
> Converting 0.000000E+00  into: 
> Traceback (innermost last):
>   File "float.py", line 11, in ?
>     print "Converting",s," into: ", float(s)
> ValueError: invalid literal for float(): 0.000000E+00
> =======

> The only lesson I can extract from it is that GTK breaks float!

Wrong lesson. The lesson you should extract from this is 'Do Not Use From
<module> Import *'. No excuse, just do NOT use it. If really you want
gdk.SomeThing available as 'SomeThing' instead of 'gdk.SomeThing', use 'from
gdk import SomeThing'.

'from <module> import *' just breaks too much stuff :P

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list