Movatterモバイル変換
[0]ホーム
[Python-ideas] Delayed Execution via Keyword
Joseph Hackmanjosephhackman at gmail.com
Sat Feb 18 00:34:28 EST 2017
Well, yes. I think the 'is' operator is where other attempts fall short,and why it would require a change to Python. But yes, it would need toforce the promise.On 17 February 2017 at 21:20, Nathaniel Smith <njs at pobox.com> wrote:> On Thu, Feb 16, 2017 at 9:24 PM, Joseph Hackman <josephhackman at gmail.com>> wrote:> > Howdy All!> >> > This suggestion is inspired by the question on "Efficient debug logging".> >> > I propose a keyword to mark an expression for delayed/lazy execution, for> > the purposes of standardizing such behavior across the language.> >> > The proposed format is:> > delayed: <expr>> > i.e. log.info("info is %s", delayed: expensiveFunction())>> People seem very excited about this as an idea, but I don't understand> how it can be implemented.>> For example, how do you propose to handle code like this?>> value = delayed: some_dict.get("whatever")> if value is None:> ...>> I.e., the question is, how does 'is' work on delayed objects? I guess> it has to force the promise and walk the proxy chain in each input and> then do an 'is' on the base objects? This seems like a really deep and> confusing change to Python's object model for a pretty marginal> feature. (This is a special case of the general observation that it's> just not possible to implement fully-transparent proxy objects in> Python.)>> -n>> --> Nathaniel J. Smith --https://vorpus.org>-------------- next part --------------An HTML attachment was scrubbed...URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170218/10e9ff99/attachment.html>
More information about the Python-ideasmailing list
[8]ページ先頭