On Fri, 21 Jul 2023 at 11:08, Dom Grigonis <dom.grigo...@gmail.com> wrote:
> Also, can't find a way to ONLY force evaluation without any additional 
> operations in this specific library. A simple callable which evaluates if 
> unevaluated & returns would do. Then:
>
> def IF(condition, when_true, when_false):
>     if condition:
>         return ensure_eval(when_true)
>     else:
>         return ensure_eval(when_false)
>
> Controls evaluation if deferred objects are provided, but can also be used 
> with `normal` values.
>

Let's tackle just this one part for a moment. What does "ensure_eval"
do? Evaluate a proxy object but not evaluate anything else? That seems
simple, but might very well be straight-up wrong. Consider:

def test_proxy(x):
    x_ = Proxy(x)
    y = ensure_eval(x_)
    y_ = ensure_eval(y)
    assert x is y
    assert x is y_

This should always succeed, right? Well, what if x is itself a Proxy
object? How does it know not to reevaluate it?

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/GTCRUPQOFP63VA2T2N7BVBO6JKR3D7I6/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to