The `eval(repr(x)) == x` is not a segment of my code; rather it is part of Python's description of what 'repr' should do:

Specifically: ` For many types, this function makes an attempt to return a string that would yield an object with the same value when passed to eval()`

So everyone in this thread can stop mentioning security concerns; I'm sure we're all aware of those and we should instead focus on what repr should do and shouldn't do.

I think it's weird to not fulfill this promise, when it should be easy to do. Further, I agree that 'inf' is:
  1. Too backwards incompatible
  2. Not the right format for Python (Python likes pascalcase, like `None`, `True`, `False`)

So again, I'd like to not focus on arguing whether a particular codebase should be using 'eval' on strings generated by repr.
Rather, my point was that the current behavior does not follow what Python suggests and says 'repr' should do.

Cade Brown
Research Assistant @ ICL (Innovative Computing Laboratory)
Personal Email:
ICL/College Email:

On Fri, Sep 4, 2020 at 9:31 PM Greg Ewing <> wrote:
On 5/09/20 10:51 am, Chris Angelico wrote:
> If you make "inf" a keyword, then even the Python
> standard library is broken.

The OP didn't suggest that, he suggested adding a new name
such as Infinity that reprs could use.

Python-ideas mailing list --
To unsubscribe send an email to
Message archived at
Code of Conduct: