Why is Python popular, while Lisp and Scheme aren't?

sismex01 at hebmex.com sismex01 at hebmex.com
Tue Nov 12 09:32:35 EST 2002


> From: Michael Hudson [mailto:mwh at python.net]
> 
> Marco Baringer <mb at bese.it> writes:
> 
> > but the problem is that the coressponding python code doesn't do the
> > same thing:
> > 
> > in openmcl 0.13b:
> > 
> > ? (* 1e10 (parse-float "0.4e-10"))
> > 0.4
> > 
> > in python 2.2 (whatever apple ships with jaguar):
> > 
> > >>> float("0.4e-10") * 1e10
> > 0.39999999999999997
> 
> This is a matter of printed representations.  OpenMCL is lying
> (slightly) to you.
> 
> Cheers,
> M.

You can tell python to lie to you also:

>>> float("0.4e-10") * 1e10
0.39999999999999997
>>> print float("0.4e-10") * 1e10
0.4


The first time, you asked for the number's repr(),
the second for it's str().  Slight difference.

-gustavo




More information about the Python-list mailing list