> That is, if you removed:
> from math import inf
> From your code, nothing would break.
Everything would break. On versions prior to the one that introduced
the new literal form, you MUST have that line, or your code won't
But it’s already there.
On versions starting with that one, you MUST NOT have that line,
as it would be a SyntaxError.
Huh? I was proposing doing it like was done for True and False in Python 2:
In : from bools import True, False
In : print True, False
but True and False are still "special" at least with ast.literal_eval:
In : ast.literal_eval("[True, False]")
Out: [True, False]
I fully agree that this "tiny benefit" is not worth breaking a lot (or hardly any) code. But it seems it can be done with very little breakage.
In fact, this is even less likely to break code than the introduction of True and False were, 'cause math,inf and numpy,inf actually do return a float with the value of inf - the very same type and value that this would produce. And frankly, it would get used a LOT less than True and False are as well.