On Tue, Aug 30, 2016 at 10:56 PM, Philipp A. <flying-sh...@web.de> wrote:
> My issue is just that it’s as much of a string as a call of a (string
> returning) function/method or an expression concatenating strings:
>
> ''.join(things)   # would you call this a string?
> '{!r}'.format(x)  # or this? it’s basically the same as this “f-string”:
> f'{x!r}'
> 'start' + 'end'   # or this? it’s a concatenation of two strings, just like
> f'start{ "end" }'

Yes, an f-string is really a form of expression, not a literal. But
prior art has generally been to have similar constructs referred to as
"interpolated strings" or similar terms:

https://en.wikipedia.org/wiki/String_interpolation

Plenty of languages have some such feature, and it's usually
considered a type of string. Notice the close parallels between actual
string literals used as format strings ("I have %d apples" % apples)
and f-strings (f"I have {apples} apples"), and how this same parallel
can be seen in many other languages. Yes, it may be a join expression
to the compiler, but it's a string to the programmer.

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/

Reply via email to