[Python-ideas] Delayed Execution via Keyword

David Mertz mertz at gnosis.cx
Sun Feb 19 13:33:10 EST 2017


On Sun, Feb 19, 2017 at 10:13 AM, Joseph Hackman <josephhackman at gmail.com>
wrote:
>
> My honest preference would be that the [] is evaluated fresh each time the
> function is called.
> def stuff(arg=delayed f()):
> would result in f() being called every time stuff() is. This seems more
> valuable to me than just doing it once when the function is first called.
>

This doesn't make sense.  Function definition time is very different than
function execution time.  Changing that distinction is a WAY bigger change
than I think we should contemplate.

Moreover, there is a completely obvious way to spell the behavior you want:

def stuff():

    arg = f()

    # ... whatever ...


This is exactly the obvious way to spell "f() is called every time stuff()
is".


-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170219/bc0cf63a/attachment.html>


More information about the Python-ideas mailing list