[Python-ideas] float('∞')=float('inf')
Gerald Britton
gerald.britton at gmail.com
Fri Jul 12 17:14:54 CEST 2013
"Just because."
so, maybe we should have the interpreter spit out
∞
instead?
I get that we special case infinity. Its an IEEE thing. I can sure
the next request coming: The various constants represented by unicode
characters.
On Fri, Jul 12, 2013 at 11:02 AM, Joshua Landau <joshua at landau.ws> wrote:
> On 12 July 2013 15:46, Laurens Van Houtven <_ at lvh.io> wrote:
>> On Fri, Jul 12, 2013 at 4:43 PM, Gerald Britton <gerald.britton at gmail.com>
>> wrote:
>>>
>>> Man I don't know how you are doing this! I just tried:
>>>
>>> float('<greek letter pi>') and got
>>>
>>> Value error: could not convert string to float '<greek letter pi>'
>>>
>>> For that matter, I can't figure out how to type the greek letter for
>>> pi in gmail! Guess I have some things to learn.
>>>
>>> So, if Python doesn't recognize the symbol for pi, why should it
>>> recognize the one for infinity?
>>
>>
>> The example he posted is of digits, not of any particular symbol for a
>> constant. The difference, obviously, is that you can't write infinity as a
>> bunch of digits, whereas you can at least approximate pi with any number of
>> digits.
>
> Ahem:
>
>>>> float("1"*310)
> inf
>
> Just because.
>
> My personal reason for thinking that unicode infinity is reasonable
> whereas unicode pi/tau/phi/etc. is not, is simply that we *already*
> special-case infinity. We do not do so for other mathematical
> constants. Additionally, Pi only holds the value of half the circle
> constant by default -- other branches of mathematics uses for other
> things and some use it as a variable. They are rare, granted, but Pi
> is not as clear cut as, say, "9" or "infinity".
--
Gerald Britton
More information about the Python-ideas
mailing list