[Python-ideas] Alternative to PEP 532: delayed evaluation of expressions

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Nov 7 00:13:29 EST 2016


C Anthony Risinger wrote:
> On Nov 6, 2016 7:32 PM, "Nathaniel Smith" <njs at pobox.com 
> <mailto:njs at pobox.com>> wrote:
>  >
>  >     log.debug!(f"Message: {message_object!r}")
> 
> Would the log.debug implementation need to fetch the context to evaluate 
> the delayed expression

Not if it expands to

    log.debug(lambda: f"Message: {message_object!r}")

> Also what is the meaning (if desirable) of something like:
> 
> def debug!(...): pass

Nothing like that would be needed. The implementation of
debug() would just be an ordinary function receiving callable
objects as parameters.

-- 
Greg


More information about the Python-ideas mailing list