[Python-ideas] float('∞')=float('inf')

Serhiy Storchaka storchaka at gmail.com
Sun Jul 14 10:40:09 CEST 2013


13.07.13 00:55, Joshua Landau написав(ла):
> On 12 July 2013 22:46, Serhiy Storchaka <storchaka at gmail.com
> <mailto:storchaka at gmail.com>> wrote:
>
>     13.07.13 00:27, Joshua Landau написав(ла):
>
>         On 12 July 2013 18:58, Serhiy Storchaka
>         <storchaka at gmail.com
>         <mailto:storchaka at gmail.com>
>         <mailto:storchaka at gmail.com
>         <mailto:storchaka at gmail.com>>> wrote:
>              I agree. But how is it related to ½ and 3.(142857)?
>         ½ === 1/2; thus is an expression
>
>
>     0.5 === 5/10. Isn't it an expression?
>
>
> No. That's like saying "1 === 2/2". There is a much more obvious
> equivalence between two ways of writing "1/2" than between two ways of
> displaying the result of "1/2".

0.5 is 5/10 by definition. The result of 1/2 is a fraction ½.

>         3.(142857) is more ambiguous, because there's not actually any
>         mathematical operator in place. But it is too much parsing for no
>         benefit, AFAICT; you would complicate something simple to solve
>         almost
>         no use-cases, and then when they are used it's harder for people
>         to work
>         out what is meant.
>
>
>     AFAIK children teach 3.(142857) before ∞. I'm sure people use
>     fractions and recurring decimals more often than infinity.
>
>
> In my experience (I'll take a good wager I'm younger than you) people
> learn first about infinity, then are taught recurrence using the
> floating-dot syntax. The bracket form for recurrence was not taught once
> during high-school for me, and although "infinity" was hardly covered
> either it's not niche knowledge.

Well, maybe it's a cultural difference. I learned recurring decimals in 
primary school (if memory serves me).

> Plus, why on earth would you use recurrence for floats? Give me a use
> case. There's a good reason for float infinity.

This is only a way to spell a general fraction in decimal. On other 
hand, ∞ is even not a real number.

> Note that I'm British.
>
>         The informal definition for "expression" with regards
>         to int and float I'm using is basically the measure of how much more
>         parsing code would need to be implemented.
>
>
>     ½ requires no more parsing code then ∞.
>
>
> Au contraire, if you accept ½ you are bound by law to accept all of the
> other fractions -- that's much more code than just allowing ∞.

If you accept ∞ you are bound by law to accept ½ and all of the other 
fractions — and that's much more code than just allowing ∞.




More information about the Python-ideas mailing list