classification
Title: Use f-strings instead of str.format within importlib
Type: performance Stage: patch review
Components: Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: gregory.p.smith Nosy List: FFY00, cheryl.sabella, eric.smith, gregory.p.smith, jaraco, miss-islington, serhiy.storchaka, xtreak
Priority: normal Keywords: patch

Created on 2019-11-05 06:20 by gregory.p.smith, last changed 2021-05-26 21:09 by jaraco.

Pull Requests
URL Status Linked Edit
PR 17058 open gregory.p.smith, 2019-11-05 06:23
PR 26383 merged jaraco, 2021-05-26 17:36
PR 26386 merged miss-islington, 2021-05-26 18:49
PR 26387 merged jaraco, 2021-05-26 19:53
PR 26389 merged miss-islington, 2021-05-26 20:16
Messages (9)
msg356005 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2019-11-05 06:20
importlib is full of str.format calls, modernizing it to use f-strings is a slight performance win and much more readable.
msg369672 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2020-05-23 00:22
Did you want this one to land in 3.9?
msg378998 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2020-10-19 19:33
Status: Waiting until after the importlib.metadata and importlib.resources backports drop support for both Python 2.7 and 3.5 as keeping them in sync would be a pain for maintainers (per jaraco on our sprint importlib-any chat today)
msg393617 - (view) Author: Filipe LaĆ­ns (FFY00) * (Python triager) Date: 2021-05-13 22:50
Both importlib_metadata and importlib_resources have dropped support for Python 2.7 and 3.5, this should now be unblocked.
msg393629 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-05-14 07:47
I just have merged a change which makes many C-style formatting as fast as f-strings (issue28307) and am working on supporting more format codes (%d, %x, %f, etc). Using C-style formatting can be a good option if you want performance and backward compatibility. It was faster than str.format() even without that optimization.
msg394453 - (view) Author: miss-islington (miss-islington) Date: 2021-05-26 18:49
New changeset e6c815d2e34be5fdf6dbe773f0781691746d2289 by Jason R. Coombs in branch 'main':
bpo-38693: importlib.metadata f-strings (GH-26383)
https://github.com/python/cpython/commit/e6c815d2e34be5fdf6dbe773f0781691746d2289
msg394454 - (view) Author: miss-islington (miss-islington) Date: 2021-05-26 19:11
New changeset 78a8428548445b501f5ebd6ff4647d93ffd8efd1 by Miss Islington (bot) in branch '3.10':
bpo-38693: importlib.metadata f-strings (GH-26383)
https://github.com/python/cpython/commit/78a8428548445b501f5ebd6ff4647d93ffd8efd1
msg394460 - (view) Author: miss-islington (miss-islington) Date: 2021-05-26 20:16
New changeset f6fbdb90ee450ad693f7a7809035d0dc968f98b7 by Jason R. Coombs in branch 'main':
bpo-38693: Prefer f-strings in importlib.resources (importlib_resources 5.0.6). (GH-26387)
https://github.com/python/cpython/commit/f6fbdb90ee450ad693f7a7809035d0dc968f98b7
msg394463 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2021-05-26 21:09
New changeset 97b4576f655c09e32d2cbcdcdbda72b1bf9f438a by Miss Islington (bot) in branch '3.10':
bpo-38693: Prefer f-strings in importlib.resources (importlib_resources 5.0.6). (GH-26387) (#26389)
https://github.com/python/cpython/commit/97b4576f655c09e32d2cbcdcdbda72b1bf9f438a
History
Date User Action Args
2021-05-26 21:09:35jaracosetmessages: + msg394463
2021-05-26 20:16:22miss-islingtonsetmessages: + msg394460
2021-05-26 20:16:21miss-islingtonsetpull_requests: + pull_request24982
2021-05-26 19:53:50jaracosetpull_requests: + pull_request24980
2021-05-26 19:11:49miss-islingtonsetmessages: + msg394454
2021-05-26 18:49:16miss-islingtonsetmessages: + msg394453
2021-05-26 18:49:14miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request24978
2021-05-26 17:36:11jaracosetnosy: + jaraco
pull_requests: + pull_request24975
2021-05-14 07:47:29serhiy.storchakasetversions: + Python 3.11, - Python 3.10
2021-05-14 07:47:18serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg393629
2021-05-13 22:50:10FFY00setnosy: + FFY00
messages: + msg393617
2020-10-19 19:33:13gregory.p.smithsetmessages: + msg378998
2020-10-19 19:29:23gregory.p.smithsetversions: + Python 3.10, - Python 3.8, Python 3.9
2020-05-23 00:22:09cheryl.sabellasetnosy: + cheryl.sabella
messages: + msg369672
2019-11-05 20:02:40eric.smithsetnosy: + eric.smith
2019-11-05 13:09:29xtreaksetnosy: + xtreak
2019-11-05 06:23:51gregory.p.smithsetkeywords: + patch
stage: patch review
pull_requests: + pull_request16569
2019-11-05 06:20:17gregory.p.smithcreate