[Python-ideas] Deferred evaluation [was Re: Draft PEP on string interpolation]

Nick Coghlan ncoghlan at gmail.com
Tue Aug 25 08:22:54 CEST 2015


On 24 August 2015 at 22:00, Steven D'Aprano <steve at pearwood.info> wrote:
> I mean, I know how to get a closure in general terms, e.g.:
>
> [(lambda : i) for i in range(10)]
>
> but I'm not seeing where you would get a closure *specifically* in
> this situation with your defer function.

I was wrong when I though you could do this trick with f-strings - you
need the delayed interpolation offered by PEP 501's i-strings in order
to access the original objects directly.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list