[Python-ideas] String interpolation for all literal strings
Andrew Barnert
abarnert at yahoo.com
Thu Aug 6 02:13:41 CEST 2015
On Aug 5, 2015, at 16:59, Chris Angelico <rosuav at gmail.com> wrote:
>
> On Thu, Aug 6, 2015 at 7:24 AM, Oscar Benjamin
> <oscar.j.benjamin at gmail.com> wrote:
>> What would be the point? If both are available then I would just
>> always use the f-string since I prefer local explicitness over the
>> global effect of a __future__ import. Or is there a plan to introduce
>> the f-prefix and then deprecate it in the even more distant future
>> when all strings behave that way?
>
> If it's done that way, the f-prefix will be like the u-prefix in
> Python 3.3+, where it's permitted for compatibility with older
> versions, but unnecessary. Future directives are the same - you can
> legally put "from __future__ import nested_scopes" into Python 3.6 and
> not get an error, even though it's now pure noise. I don't have a
> problem with that.
>
> Whether or not it's good for string literals to support interpolation,
> though, I'm not sure about. The idea that stuff should get
> interpolated into strings fits a shell scripting language perfectly,
> but I'm not fully convinced it's a good thing for an applications
> language. How shelly is Python? Or, what other non-shell languages
> have this kind of feature? PHP does (which is hardly an
> advertisement!); I can't think of any others off hand, any pointers?
Guido's specific inspiration was Swift, which is about as "applicationy" a language as you can get.
More information about the Python-ideas
mailing list