[Python-ideas] float('∞')=float('inf')
Chris “Kwpolska” Warrick
kwpolska at gmail.com
Fri Jul 12 18:08:19 CEST 2013
On Fri, Jul 12, 2013 at 5:51 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Sat, Jul 13, 2013 at 1:42 AM, Serhiy Storchaka <storchaka at gmail.com> wrote:
>> 12.07.13 17:52, Chris Angelico написав(ла):
>>>
>>> On Sat, Jul 13, 2013 at 12:43 AM, Gerald Britton
>>> <gerald.britton at gmail.com> wrote:
>>>>
>>>> So, if Python doesn't recognize the symbol for pi, why should it
>>>> recognize the one for infinity?
>>>
>>>
>>> Considering that Python can't represent π in a float anyway, I
>>> wouldn't be too bothered.
>>
>>
>> However Python can represent ½ in a float. Shouldn't it recognize the symbol
>> for ½?
>
> That one would be more plausible, in the same way that many of the
> other Unicode digits are accepted. Not sure there's all that much of a
> use-case for it, though, and if it's going to complicate the code I
> wouldn't bother; for instance, it's fairly obvious that "3½" should be
> accepted, but what does "½3" mean? I'm -0 on it initially, but would
> change that to +0 if a suitable answer is found for that (even if it's
> "raise ValueError, same as float('1.1.1') does") that doesn't make the
> code horrendous.
Umm, last time I checked, ³*½ = 1.5.
Which brings us to yet another problem: will we implement magic so
that '10²' becomes 100? And '√25' becomes 5?
--
Kwpolska <http://kwpolska.tk> | GPG KEY: 5EAAEA16
stop html mail | always bottom-post
http://asciiribbon.org | http://caliburn.nl/topposting.html
More information about the Python-ideas
mailing list