On 2/19/17, David Mertz <me...@gnosis.cx> wrote: > On Sun, Feb 19, 2017 at 10:13 AM, Joseph Hackman <josephhack...@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".
A few more complicated will be set non default value to argument. But how to spell same behaviour in this case? -> def stuff(arg=delayed locals()) _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/