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

Joshua Landau joshua at landau.ws
Fri Jul 12 23:27:48 CEST 2013


On 12 July 2013 18:58, Serhiy Storchaka <storchaka at gmail.com> wrote:

> 12.07.13 20:18, Joshua Landau написав(ла):
>
>  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.
>>
>
> I agree. But how is it related to ½ and 3.(142857)?


½ === 1/2; thus is an expression

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


More information about the Python-ideas mailing list