On Sat, Oct 23, 2021 at 9:21 PM Chris Angelico <[email protected]> wrote:
> On Sun, Oct 24, 2021 at 2:52 PM David Mertz, Ph.D. > <[email protected]> wrote: > > > > On Sat, Oct 23, 2021, 11:46 PM David Mertz, Ph.D. > >>> > >>> def f(x=defer: a + b): > >>> a, b = 3, 5 > >>> return x > >>> > >>> Would this return 8, or a defer-expression? If 8, then the scope isn't > truly dynamic, since there's no way to keep it deferred until it moves to > another scope. If not 8, then I'm not sure how you'd define the scope or > what triggers its evaluation. > > > > > > Oh... Keep in mind I'm proposing a strawman deliberately, but the most > natural approach to keeping an object deferred rather than evaluated is > simply to say so: > > > > def f(x=defer: a + b): > > a, b = 3, 5 > > fn2(defer: x) # look for local a, b within fn2() if needed > > # ... other stuff > > return x # return 8 here > > > > How would it know to look for a and b inside fn2's scope, instead of > looking for x inside fn2's scope? > I am worried that this side-thread about dynamic scopes (which are a ridiculous idea IMO) will derail the decent proposal of the PEP. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/67GZJXK7LIXT5EG5TX6T5TGPUVXHWB5A/ Code of Conduct: http://python.org/psf/codeofconduct/
