[Python-ideas] float('∞')=float('inf')
Joshua Landau
joshua at landau.ws
Fri Jul 12 16:10:13 CEST 2013
On 12 July 2013 14:31, Andreas Hagmüller <hagmueller at aim-online.com> wrote:
> int ('100%') = 1?
> float('1%') = 0.01?
> -1
>> 12.07.13 15:36, Zaur Shibzukhov написав(ла):
>>> Is it good idea to allow
>>> float('∞') to be float('inf') in python?
>>
>> float('½') == 0.5?
>> float('3.(142857)') == 22/7?
>> int('Ⅶ') == 7?
>> int('✌') == 2?
No-one has implied that int or float should parse mathematical
*expressions*, but just that unicode infinity should be one more way
to write "infinity". Consider that:
int(1) == int(١) == int(۱) == int(߁) == int(१) == int(১) == int(੧) ==
int(૧) == int(୧) == int(௧) == int(౧) == int(೧) == int(൧) == int(๑) ==
int(໑) == int(༡) == int(၁) == int(႑) == int(១) == int(᠑) == int(᥇) ==
int(᧑) == int(᪁) == int(᪑) == int(᭑) == int(᮱) == int(᱁) == int(᱑) ==
int(꘡) == int(꣑) == int(꤁) == int(꧑) == int(꩑) == int(꯱) == int(1) ==
int(𐒡) == int(𑁧) == int(𑃱) == int(𑄷) == int(𑇑) == int(𑛁) ==
int(𝟏) == int(𝟙) == int(𝟣) == int(𝟭) == int(𝟷)
and that
float("inf") == float("infinity") == float("INF") == float("INFINITY")
== float("Inf") == float("Infinity")
int and float are obviously meant to handle abstract inputs (not
expressions) and unicode infinity is an extension of this. Your
"analogies" are inapt.
More information about the Python-ideas
mailing list