[issue38351] Modernize email example from %-formatting to f-string

Kyle Stanley report at bugs.python.org
Thu Oct 3 01:06:25 EDT 2019


Kyle Stanley <aeros167 at gmail.com> added the comment:

> For the most part, templating examples can be switched to the .format() style but shouldn't be switched to f-strings.

Is there no specific use case for the older "%s" % sub template that .format() doesn't have?

> The former technique is still necessary if someone wants to move templates to an external file

Interesting, I wasn't aware of that. This seems like it might be worth a brief mention in https://docs.python.org/3.9/library/stdtypes.html#str.format. 

> AFAICT, it will be around forever, so people still need to see some examples of each.

To allow users to see examples of each, would you suggest that we should leave the existing .format() examples as is and have more recently created examples use f-strings? I'd be okay with this, as long as there's a balance of both everywhere (particularly in the tutorial).

Personally, I think that the f-string examples should be used more commonly used since they're generally more concise and readable. But, I can definitely understand the purpose of leaving the older ones around as long as they have a specific use case and are still utilized.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38351>
_______________________________________


More information about the Python-bugs-list mailing list