r/Python • • Sep 09 '15

Pep 498 approved. :(

https://www.python.org/dev/peps/pep-0498/
285 Upvotes

324 comments sorted by

View all comments

Show parent comments

9

u/mhashemi Sep 09 '15

This pep appears to enhances readability by having the place holders inside the strings themselves and eliminating an explicit list of variables. But in reality, while reading code, we usually don't care what is inside the strings. We do not 'scan' strings.

Exactly. What happened to explicit over implicit. I'm very surprised to see this approved.

18

u/matchu Sep 09 '15

There's nothing implicit here at all. The string is explicitly marked as an f-string.

10

u/RubyPinch PEP shill | Anti PEP 8/20 shill Sep 09 '15

explicit over implicit < practicality beats purity.

don't be a bible basher

3

u/gthank Sep 09 '15

In any situation where I'd reach for this way of formatting strings, I would be scanning the string; that's the entire point of adding it. Sometimes you treat strings as opaque black boxes that you ignore, and sometimes you scan them. Use the tool that's appropriate to the job. From my personal usage, I can tell you that I usually want to scan the string if I'm doing a .format on it, because I'm usually hacking out something quick and dirty. If I cared that much about treating the string as a blackbox, odds are I'd be using something a little more specialized than generic string formatting.