On Fri, Sep 04, 2020 at 08:52:22PM -0700, Christopher Barker wrote:
I am a -0 on this, but I think it was Greg Ewing that presented a real use case:
There is no way to use literal_eval that gets you an inf (or NaN value).
Which is a real, though maybe not important, use case.
That's not a *use-case*. A use-case is practical problem you are trying to solve.
Without a use-case for why you need literal_value to return an inf, that's merely an observation, no different from the observation that there is no way to use zip or list to get an inf. It's true, but so what?
That's not a rhetorical question. It might be that there is a good use-case for using literal_eval and needing to generate infinities.
But there are many objects that you can't construct with literal_eval. Because they aren't literals, or even semi-literals like tuple displays and complex numbers. It's not clear to me that we should care about infs and NANs in literal_eval.
But if we should care, making inf (and NAN?) a builtin constant is probably not the best solution.