[Python-ideas] String interpolation: environment variables, command substitution

Eric V. Smith eric at trueblade.com
Wed Aug 26 22:02:13 CEST 2015


On 08/26/2015 03:53 PM, Mike Miller wrote:
> Hold on, it took f'' strings a while to grow on you, give it a few
> minutes.  ;)
> 
> I'd like Python to be competitive with other (shell) scripting
> languages, and appeals to purity stand in the way of that.  Sometimes
> practical is just darn useful.
> 
> We've already acquiesced to arbitrary expressions, so this is a small
> further step, icing on the cake, no?  I believe Guido mentioned
> something about "half-measures" in one of his messages.

Python is never going to be bash.

>>> env=os.environ.get
>>> f'HOME={env("HOME")}'
'HOME=/home/eric'

That's good enough.

Eric.



More information about the Python-ideas mailing list