[Python-Dev] Subtle difference between f-strings and str.format()

Serhiy Storchaka storchaka at gmail.com
Wed Mar 28 14:44:18 EDT 2018


28.03.18 19:20, Guido van Rossum пише:

> Hm, without thinking too much about it I'd say it's okay to change the 
> evaluation order.

Do you mean the option 3, right? This is the simplest option. I have 
already wrote a PR for optimizing old-style formating [1], but have not 
merged it yet due to this change of semantic.

> Can these optimizations be disabled with something like -O0?

Currently there is no way to disable optimizations. There is an open 
issue with a request for this. [2]

[1] https://github.com/python/cpython/pull/5012
[2] https://bugs.python.org/issue2506



More information about the Python-Dev mailing list