On Wed, Dec 6, 2017 at 8:24 PM, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > On Wed, 6 Dec 2017 12:21 pm, Chris Angelico wrote: > >> On Wed, Dec 6, 2017 at 11:54 AM, John Pote <johnp...@jptechnical.co.uk> >> wrote: >>> >>> On 06/12/2017 00:16, Steve D'Aprano wrote: >>>> >>>> Anyone got a handy copy of Python 3.6 available to test something for me? >>>> >>>> What does compile('f"{spam} {eggs}"', '', 'single') return? > > [...] > >> I think Steve just wanted to see what we'd all define spam and eggs as. >> >> ChrisA >> *ducking for cover* > > Possibly duck eggs :-) > > > I was thinking of responding to your comment on Python-Ideas that said there > is no way to represent an unevaluated f-string in Python, but then I decided > that even for me that was too pedantic. >
Considering that it isn't an object, it'd be on par with saying that there's no way to represent an unevaluated "if-else" expression. You can wrap it in a function and carry that function around, or you can use the source code and then exec it when you need it, but neither of those really represents an unevaluated f-string - they represent something else that might be equivalent. So yeah, even for the great D'Aprano, that would be a bit too pedantic. :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list