On Sat, May 04, 2019 at 06:51:39PM +0300, Serhiy Storchaka wrote: > It is less important for f-strings because you can use arbitrary > expressions, but even in this case f"Hello, {name!x}!" or f"Hello, > {name!xml}!" looks better than f"Hello, {html.escape(name)}!" or > f"Hello, {x(name)}!".
html.escape(name) is mostly self-documenting. !x is a cryptic, arbitrary code. Why !x rather than !e ("escape") or !h ("html") or !g for that matter? Compact mini-languages like regexes and format codes are compact but cryptic. They're harder to read, especially when you're reading less common codes. Probably most people could guess that %y in a date format string means "year", but how many people will recognise %G and %j without looking them up? -- Steven _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/