[Python-ideas] Alternative to PEP 532: delayed evaluation of expressions
C Anthony Risinger
anthony at xtfx.me
Mon Nov 7 00:08:22 EST 2016
On Nov 6, 2016 7:32 PM, "Nathaniel Smith" <njs at pobox.com> wrote:
>
> [...]
>
> Some other use cases:
>
> Log some complicated object, but only pay the cost of stringifying the
> object if debugging is enabled:
>
> log.debug!(f"Message: {message_object!r}")
Would the log.debug implementation need to fetch the context to evaluate
the delayed expression (say by using sys._getframe) or would that be bound?
Is a frame necessary or just a (bound?) symbol table? Could a substitute be
provided by on evaluation?
Curious how this looks to the callee and what is possible.
Also what is the meaning (if desirable) of something like:
def debug!(...): pass
Persistent delayed calls? Delayed default arguments? Something else? Not
valid?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161106/f7879898/attachment.html>
More information about the Python-ideas
mailing list