This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Jason Spencer
Recipients Jason Spencer, eric.smith, martin.panter
Date 2018-08-20.16:26:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
Then I would argue that it is at least a documentation bug.  The 3.6 format
spec mini language still claims that {} is equivalent to {:s}, which now is
only conditionally true.

I would also argue that having different behavior for {} and {:s}, which
are semantically the same in the client's eye, forces the client code to
understand more about the object they are stringifying than should be
necessary.  If one works, so should the other by all descriptions of the
format spec.  If the format spec is *just* ':s', the library should call
the target's __str__ if __format__ is not defined.  The library seems
willing to do this for the empty format string, but not when the client
code specifically asks for a string....

On Sat, Aug 18, 2018 at 10:12 AM Eric V. Smith <>

> Eric V. Smith <> added the comment:
> I agree this is the desired behavior, and not a bug.
> Because you are not specifying a __format__ in your class,
> object.__format__ is being called. By design, it does not understand any
> formatting specifiers, instead reserving them for your class to implement.
> "!s" is the correct way to convert your type to a string. Either that, or
> add a __format__ that understands "s".
> Note that not all types understand "s", for example, datetime.
> ----------
> assignee:  -> eric.smith
> nosy: +eric.smith
> stage:  -> resolved
> status: pending -> closed
> _______________________________________
> Python tracker <>
> <>
> _______________________________________
Date User Action Args
2018-08-20 16:26:18Jason Spencersetrecipients: + Jason Spencer, eric.smith, martin.panter
2018-08-20 16:26:18Jason Spencerlinkissue34425 messages
2018-08-20 16:26:18Jason Spencercreate