<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 09/13/2018 07:01 AM, Eric V. Smith
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:55d6bf1f-208d-973d-e283-684b8da43c92@trueblade.com">On
      9/12/2018 8:33 PM, Victor Stinner wrote:
      <br>
      <br>
      <blockquote type="cite">Hi,
        <br>
        <br>
        For the type name, sometimes, we only get a type (not an
        instance),
        <br>
        and we want to format its FQN. IMHO we need to provide ways to
        format
        <br>
        the FQN of a type for *types* and for *instances*. Here is my
        <br>
        proposal:
        <br>
        <br>
        * Add !t conversion to format string
        <br>
      </blockquote>
      <br>
      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.</blockquote>
    <br>
    <br>
    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:<br>
    <ul>
      <li>If Py_TYPE() is a bad API, then it's a bad API and should be
        replaced.  We should have a new version of Py_TYPE() that
        returns a strong reference.</li>
      <li>If we're talking about formatting error messages, we're
        formatting an exception, which means we're already no longer in
        performance-sensitive code.  So we should use the new API that
        returns a strong reference.  The negligible speed hit of taking
        the extra reference will be irrelevant.<br>
      </li>
    </ul>
    <br>
    Cheers,<br>
    <br>
    <br>
    <i>/arry</i><br>
  </body>
</html>