[SciPy-user] Re: Python number handling?

Grant Edwards grante at visi.com
Fri Jul 15 08:20:35 CDT 2005


On 2005-07-15, Howey, David A <d.howey at imperial.ac.uk> wrote:
> I'm new to python...
> Why, why oh why did someone decide to make python do this:
>
> Integer case
>
> In [5]: 107 / 4 
> Out[5]: 26
>
> Float case
>
> In [6]: 107.0  / 4
> Out[6]: 26.75
>
> I'm a bit worried that when it come to using variables, because you
> don't declare them (eg as integer or float) python might mess up
> division and give you the first result above rather than the second.

How could that happen?  You have complete control over the
types of objects you use.  You might screw up, but Python won't.


> Has anyone had any problems with this?

No.  What sort of problems do you envision?

-- 
Grant Edwards                   grante             Yow!  YOW!! The land of the
                                  at               rising SONY!!
                               visi.com            



More information about the SciPy-user mailing list