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

Joshua Landau joshua at landau.ws
Fri Jul 12 23:55:28 CEST 2013


On 12 July 2013 22:46, Serhiy Storchaka <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>> 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".


>  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.

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

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 ∞.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130712/79b8336c/attachment-0001.html>


More information about the Python-ideas mailing list