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

Joshua Landau joshua at landau.ws
Fri Jul 12 19:18:51 CEST 2013


On 12 July 2013 18:12, Serhiy Storchaka <storchaka at gmail.com> wrote:
> 12.07.13 18:50, Joshua Landau написав(ла):
>
>> On 12 July 2013 16:26, Serhiy Storchaka <storchaka at gmail.com> wrote:
>>>
>>> 12.07.13 17:10, Joshua Landau написав(ла):
>>>
>>>> int and float are obviously meant to handle abstract inputs (not
>>>> expressions) and unicode infinity is an extension of this. Your
>>>> "analogies" are inapt.
>>>
>>>
>>>
>>> Why you think ½ (this is only one symbol!) and 3.(142857) (this is a
>>> decimal
>>> notation of the 22/7 fraction) are expressions, but ∞ or even -1 are not?
>>
>>
>> For the same reason that 0.5 and [0,
>> 1, 2, 3, 4] are literals but 1/2 and range(5) are not.
>
>
> ∞ is not a literal.

So? float("[1, 2, 3, 4]") isn't valid -- I never claimed there was 1:1
mapping between literals and things that float should except. I said
that float shouldn't parse expressions.


More information about the Python-ideas mailing list