New submission from Mark Shannon <m...@hotpy.org>: f-string expressions can be formatted in four ways: with or without a conversion and with or without a format specifier
Rather than have one bytecode that parses the opcode argument at runtime it would be more efficient and produce a cleaner interpreter for the compiler to produce one or two bytecode as required. The bytecodes should be: CONVERT_VALUE convert_fn FORMAT_SIMPLE FORMAT_WITH_SPEC For simple format expressions with no conversion or format specifier, which make up about 3/4 of all format expressions in the standard library, just the bytecode FORMAT_SIMPLE need be executed. ---------- components: Interpreter Core messages: 314000 nosy: Mark.Shannon priority: normal severity: normal status: open title: The bytecode for f-string formatting is inefficient. type: performance versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33092> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com