diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-05-08 19:33:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-08 19:33:10 (GMT) |
commit | a0bd9e9c11f5f52c7ddd19144c8230da016b53c6 (patch) | |
tree | fff84d3ae52bfbf3b3e50779625c7b52b01d94b0 /Doc/whatsnew/3.11.rst | |
parent | 6692dc1ca99fb34a19d0a4b93cf8e10619490001 (diff) | |
download | cpython-a0bd9e9c11f5f52c7ddd19144c8230da016b53c6.zip cpython-a0bd9e9c11f5f52c7ddd19144c8230da016b53c6.tar.gz cpython-a0bd9e9c11f5f52c7ddd19144c8230da016b53c6.tar.bz2 |
bpo-28307: Convert simple C-style formatting with literal format into f-string. (GH-5012)
C-style formatting with literal format containing only format codes
%s, %r and %a (with optional width, precision and alignment)
will be converted to an equivalent f-string expression.
It can speed up formatting more than 2 times by eliminating
runtime parsing of the format string and creating temporary tuple.
Diffstat (limited to 'Doc/whatsnew/3.11.rst')
-rw-r--r-- | Doc/whatsnew/3.11.rst | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 8e97c09..464a97e 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -90,7 +90,10 @@ Improved Modules Optimizations ============= - +* Compiler optimizes now simple C-style formatting with literal format + containing only format codes ``%s``, ``%r`` and ``%a`` and makes it as + fast as corresponding f-string expression. + (Contributed by Serhiy Storchaka in :issue:`28307`.) Build and C API Changes |