On Fri, Aug 19, 2016 at 10:18 AM, Steven D'Aprano <st...@pearwood.info> wrote: > On Fri, Aug 19, 2016 at 02:17:29AM +1000, Chris Angelico wrote: > >> Format codes are just text, > > I really think that is wrong. They're more like executable code. > > https://www.python.org/dev/peps/pep-0498/#expression-evaluation > > "Just text" implies it is data: > > result = "function(arg)" > > like the string on the right hand side of the = is data. You wouldn't > say that a function call was data (although it may *return* data): > > result = function(arg) > > or that it was "just text", and you shouldn't say the same about: > > result = f"{function(arg)}" > > either since they are functionally equivalent. Format codes are "just > text" only in the sense that source code is "just text". Its technically > correct and horribly misleading. >
By "format code", I'm talking about the bit after the colon, which isn't executable code, but is a directive that says how the result is to be formatted. These have existed since str.format() was introduced, and have always been text, not code. ChrisA _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/