I'm trying to emulate Python's repr exactly in Java; this includes the use of single quotes where possible. What method does Python use to determine what sort of quotes it should emit?
Edit: I'm looking for some actual code, somewhere in the web of Python. I've already looked at Objects/unicodeobject.c and some of Objects/strlib/, but I couldn't find anything besides escape sequences for Unicode.
I guess it will use single quotes unless it need to use it inside the string.
As show in:
Output: