
On Thu, 23 Jun 2022 at 11:35, Joao S. O. Bueno <jsbueno@python.org.br> wrote:
Martin Di Paola wrote:
Three cases: Dask/PySpark, Django's ORM and selectq. All of them implement deferred expressions but all of them "compute" them in very specific ways (aka, they plan and execute the computation differently).
So - I've been hit with the "transparency execution of deferred code" dilemma before.
What happens is that: Python, at one point will have to "use" an object - and that use is through calling one of the dunder methods. Up to that time, like, just writing the object name in a no-operation line, does nothing. (unless the line is in a REPL, which will then call the __repr__ method in the object).
Why are dunder methods special? Does being passed to some other function also do nothing? What about a non-dunder attribute? Especially, does being involved in an 'is' check count as using an object? dflt = fetch_cached_object("default") mine = later fetch_cached_object(user.keyword) ... if mine is dflt: ... # "using" mine? Or not? Does it make a difference whether the object has previously been poked in some other way? ChrisA