Re: [Python-ideas] from __future__ import runtime_default_kwargs

2019-03-11 Thread Jonathan Fine
Steven D'Aprano wrote: > Some weeks ago, you started a discussion here about "Clearer > Communication". Here's another suggestion to help: don't expect your > readers to either guess, or infer from the code, what your proposal > means. As the Zen of Python says: > > Explicit is better than

Re: [Python-ideas] from __future__ import runtime_default_kwargs

2019-03-11 Thread Steven D'Aprano
Hi James, Some weeks ago, you started a discussion here about "Clearer Communication". Here's another suggestion to help: don't expect your readers to either guess, or infer from the code, what your proposal means. As the Zen of Python says: Explicit is better than implicit. Looking at your

Re: [Python-ideas] from __future__ import runtime_default_kwargs

2019-03-11 Thread Jonathan Fine
Thank you, James, for your idea. For the benefit of those who may not know, please explain the problem you wish to solve. That way we could suggest, discuss and compare other solutions. -- Jonathan ___ Python-ideas mailing list Python-ideas@python.org

Re: [Python-ideas] from __future__ import runtime_default_kwargs

2019-03-11 Thread Chris Angelico
On Mon, Mar 11, 2019 at 10:28 PM James Lu wrote: > > When > > from __future__ import runtime_default_kwargs > > > > Is run, > > def a(b=1, c=b+2, d=[]): > pass > > behaves as (if the peephole optimizer didn’t exist) > > def a(b=None, c=None): > if b is None: > b = 1 > if c is

[Python-ideas] from __future__ import runtime_default_kwargs

2019-03-11 Thread James Lu
When from __future__ import runtime_default_kwargs Is run, def a(b=1, c=b+2, d=[]): pass behaves as (if the peephole optimizer didn’t exist) def a(b=None, c=None): if b is None: b = 1 if c is None: c = b + 2 if d is None: d = [] i.e. the keyword