On 09/13/2018 07:01 AM, Eric V. Smith wrote:
On 9/12/2018 8:33 PM, Victor Stinner wrote:

Hi,

For the type name, sometimes, we only get a type (not an instance),
and we want to format its FQN. IMHO we need to provide ways to format
the FQN of a type for *types* and for *instances*. Here is my
proposal:

* Add !t conversion to format string

I'm strongly opposed to this. This !t conversion would not be widely applicable enough to be generally useful, and would need to be exposed in the f-string and str.format() documentation, even though 99% of programmers would never need or see it.


I discussed this with Eric in-person this morning at the core dev sprints.  Eric's understanding is that this is motivated by the fact that Py_TYPE() returns a borrowed reference, and by switching to this !t conversion we could avoid using Py_TYPE() when formatting error messages.  My quick thoughts on this:

Cheers,


/arry