Author crwilcox
Recipients crwilcox, jitterman, zach.ware
Date 2020-02-10.18:55:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The attached code implements `__format__` on the `Collections` class. In case 1, the template passed to `__format__` is "{}: {}|". In case 2, a name error will occur while processing the f string and v will not be found as no object 'v' exists in locals or globals.

In reviewing PEP 0498,, I think the difference is in what object is being formatted.

In case 1 of the attached code, the collection is being formatted. In case 2 where f-strings are used, 'v' is being formatted. Because v doesn't exist in this context, it fails. I found this in the PEP and I think it is what is going on here.

Note that __format__() is not called directly on each value. The actual code uses the equivalent of type(value).__format__(value, format_spec), or format(value, format_spec). See the documentation of the builtin format() function for more details.

Date User Action Args
2020-02-10 18:55:45crwilcoxsetrecipients: + crwilcox, zach.ware, jitterman
2020-02-10 18:55:45crwilcoxsetmessageid: <>
2020-02-10 18:55:45crwilcoxlinkissue39601 messages
2020-02-10 18:55:45crwilcoxcreate