[Python-Dev] f-strings

Stephen J. Turnbull turnbull.stephen.fw at u.tsukuba.ac.jp
Tue Dec 19 11:47:28 EST 2017


Mariatta Wijaya writes:
 > I agree it's useful info :)
 > 
 > I went ahead and made a PR [1].
 > In my PR, I simply linked to the Format Specification Mini Language[2] from
 > f-strings documentation[3].
 > 
 > Not sure about updating PEP 498 at this point..

I don't see any reason not to document tips and tricks with f-strings,
and this is a nice and useful example.  But it looks like TOOWTDI to
me.  The syntax is documented (6.1.3.1 in the Library Reference),
along with a specific relevant example ("Aligning the text and
specifying a width" in 6.1.3.2).

So -1 on putting the recipe in the reference docs.  I really don't
think this kind of information belongs in a PEP for sure, and probably
not even in the Library Reference.  The Tutorial might be a good place
for it, though.

If I were Bach, I'd compose a more-itertools-like module to be named
Variations_on_the_F_String. :-)

Steve



More information about the Python-Dev mailing list