Steven D'Aprano wrote: > On Mon, Apr 02, 2018 at 06:49:52AM -0600, Mats Wichmann wrote:
>> so since we're all learning things here, how would this play out with >> the new f-strings? > > I don't think f-strings are even a bit Pythonic. > > They look like string constants, but they're actually a hidden call to > eval(). But because you cannot f-ify a string variable (without an additional eval() call) you aren't tempted to feed them user-provided data. > They can only be used once, and are not re-usable (unlike proper > templates): You can't eat your cake an have it. As "proper templates" they would indeed be as dangerous as eval(). > By my count, they violate at least three of the Zen of Python: > > Explicit is better than implicit. > Simple is better than complex. > Special cases aren't special enough to break the rules. As I'm getting tired of writing "...{foo}...{bar}...".format(foo=foo, bar=bar, ...) lately I'd say they win big in the "practicality beats you-name-it" area. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor