for / while else doesn't make sense

Rustom Mody rustompmody at gmail.com
Sun May 22 13:22:42 EDT 2016


On Sunday, May 22, 2016 at 10:20:11 PM UTC+5:30, Jon Ribbens wrote:
> On 2016-05-22, Chris Angelico wrote:
> > Python's int and float types are both approximations to a
> > non-representable type called a "real number".
> 
> Sorry, I have to stop you there as the entire premise of your post is
> clearly wrong. "int" is not "an approximation of real numbers", it's
> a model of the mathematical concept "integers", and it's not an
> approximation, and since the long/int unification you can't even
> overflow it as I understand things (barring ridiculous situations like
> running out of memory).

Well maybe Chris should have said (or meant to say?)

In math:
ℤ ⊆ ℝ

whereas in programming int and float are disjoint types.

So structurally the (int,float) type pair poorly approximates the 
(ℤ, ℝ) pair of math sets

Doesnt mean I agree with

> we can't perfectly represent real numbers or calculate with them, so we do 
> the best we can

Floats are a grotesque travesty of ℝ
At the least, interval arithmetic can help automatically do the numerical 
analysis for you.
Then there are all kinds of rational approximations like continued fractions
which are better than ℚ
All the way to "computable real numbers"

We're stuck with them because that's the hardware we've got.
Nothing intrinsic or necessary about it



More information about the Python-list mailing list