[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Christopher Barker
On Sun, Dec 5, 2021 at 10:38 AM David Mertz, Ph.D. wrote: > I first discussed the idea of a "generalized deferred object/type" on this > list at least two years ago, probably more than three (I haven't looked > through archives lately to be sure the dates). The idea got some vague > interest, but

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Inada Naoki
I read PEP 671 today, and I feel PEP 671 is not as useful as someone expected. For example, PEP 671 has this example: def bisect_right(a, x, lo=0, hi=>len(a), *, key=None): But I think we can not change the signature for backward compatibility. For example, def search(self, x, lo=0, hi=No

[Python-ideas] Re: PEP 671 review of default arguments evaluation in other languages

2021-12-05 Thread David Mertz, Ph.D.
On Sun, Dec 5, 2021 at 6:44 PM Steven D'Aprano wrote: > How do you get nine in the first place? Putting aside *args and > **kwargs, the existing parameter matrix is either 3x2 or 3x2x∞ depending > on whether you include types as part of the matrix. > which makes 3x2 = 6, not 9. Adding a distincti

[Python-ideas] Re: PEP 671 review of default arguments evaluation in other languages

2021-12-05 Thread Finn Mason
On Sun, Dec 5, 2021, 12:11 PM Brendan Barnwell wrote: > On 2021-12-04 20:01, David Mertz, Ph.D. wrote: > > > > There are perfectly good ways to "fake" either one if you only have the > > other. Probably more work is needed to simulate early binding, but there > > are ways to achieve the same effe

[Python-ideas] Re: PEP 671 review of default arguments evaluation in other languages

2021-12-05 Thread Steven D'Aprano
On Sat, Dec 04, 2021 at 11:39:00PM -0500, David Mertz, Ph.D. wrote: > Wow! That's an even bigger teaching nightmare than I envisioned in my > prior post. Nine (3x3) different kinds of parameters is already too big of > a cognitive burden. Doubling that to 18 kinds makes me shudder. I admit I >

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread 2QdxY4RzWzUUiLuE
On 2021-12-06 at 02:15:36 +1100, Chris Angelico wrote: > On Mon, Dec 6, 2021 at 1:48 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > On 2021-12-05 at 20:30:53 +1100, > > Chris Angelico wrote: > > [...] > > > https://pyauth.github.io/pyotp/#time-based-otps > > > > I agree. *Not* conflat

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Rob Cliffe via Python-ideas
On 05/12/2021 18:37, David Mertz, Ph.D. wrote: On Sun, Dec 5, 2021, 12:33 PM Chris Angelico And quite frankly, the tone of this list is sounding like "shut up, go away, don't do anything, because there are other proposals that nobody can be bothered writing up, but if they existed,

[Python-ideas] Re: Compiler from python to WebAssembly

2021-12-05 Thread Jonathan Fine
Hi Ricard Python to web assembly is a good idea that is already being developed. The first result from this search https://www.google.com/search?q=python+webassembly is the project https://github.com/pyodide/pyodide. Also relevant is https://www.theregister.com/2021/11/30/python_web_wasm/ You lo

[Python-ideas] Re: PEP 671 review of default arguments evaluation in other languages

2021-12-05 Thread Brendan Barnwell
On 2021-12-04 20:01, David Mertz, Ph.D. wrote: There are perfectly good ways to "fake" either one if you only have the other. Probably more work is needed to simulate early binding, but there are ways to achieve the same effect. However, that language would not be Python. That ship sailed in 19

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Chris Angelico
On Mon, Dec 6, 2021 at 5:51 AM David Mertz, Ph.D. wrote: > > On Sun, Dec 5, 2021, 1:48 PM Chris Angelico >> >> You: "Keep the status quo, all done" >> Also you: "Let's wait for something better" > > > Now is better than never. > Although never is often better than *right* now. Neither of which sa

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread David Mertz, Ph.D.
On Sun, Dec 5, 2021, 1:48 PM Chris Angelico > You: "Keep the status quo, all done" > Also you: "Let's wait for something better" > Now is better than never. Although never is often better than *right* now. ___ Python-ideas mailing list -- python-ideas@p

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Chris Angelico
On Mon, Dec 6, 2021 at 5:38 AM David Mertz, Ph.D. wrote: > > On Sun, Dec 5, 2021, 12:33 PM Chris Angelico >> >> And quite frankly, the tone of this list is sounding like "shut up, go away, >> don't do anything, because there are other proposals that nobody can be >> bothered writing up, but if t

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Chris Angelico
On Mon, Dec 6, 2021 at 5:20 AM Christopher Barker wrote: > > On Sun, Dec 5, 2021 at 3:28 AM Chris Angelico wrote: >> >> (That said, though: it would be rather nice to be able to do algebra >> with function signatures. For instance, you could say "my signature is >> that function's kwargs plus fro

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread David Mertz, Ph.D.
On Sun, Dec 5, 2021, 12:33 PM Chris Angelico > And quite frankly, the tone of this list is sounding like "shut up, go > away, don't do anything, because there are other proposals that nobody can > be bothered writing up, but if they existed, they'd be way better than what > you're doing". Not exac

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Christopher Barker
On Sun, Dec 5, 2021 at 3:28 AM Chris Angelico wrote: > (That said, though: it would be rather nice to be able to do algebra > with function signatures. For instance, you could say "my signature is > that function's kwargs plus frobnosticate=42" or "my signature is that > function's kwargs minus s

[Python-ideas] Compiler from python to WebAssembly

2021-12-05 Thread Ricard Sanchez Besalduch
Hi It would be cool to make a compiler from python to WebAssembly. Adapting the actual python compiler. And making an interface to interact with the DOM as a python library. The final idea is to replace JavaScript with Python. With that we could use python in the frontend and in the backend, w

[Python-ideas] Re: PEP 671 review of default arguments evaluation in other languages

2021-12-05 Thread Rob Cliffe via Python-ideas
On 05/12/2021 04:01, David Mertz, Ph.D. wrote: The cost here is that EVERY SINGLE student learning Python needs to add this new construct to their mental load. EVERY book and tutorial needs to be updated. EVERY experienced developer has to spend extra effort understanding and writing code.

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Rob Cliffe via Python-ideas
On 05/12/2021 15:16, Steven D'Aprano wrote: On Wed, Dec 01, 2021 at 12:26:33PM +, Matt del Valle wrote: I'm sure that people will learn the many uses of the arrow symbols. After all, people learn Perl and APL :-) Closer to home, we also learn all the many different uses of the star symbol

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Chris Angelico
On Mon, Dec 6, 2021 at 4:13 AM Steven D'Aprano wrote: > > On Mon, Dec 06, 2021 at 02:08:46AM +1100, Chris Angelico wrote: > > > I want to have them syntactically as part of the body > > of the function, and semantically as part of the function call. > > Then you'll love the status quo, because tha

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Steven D'Aprano
On Mon, Dec 06, 2021 at 02:08:46AM +1100, Chris Angelico wrote: > I want to have them syntactically as part of the body > of the function, and semantically as part of the function call. Then you'll love the status quo, because that's exactly what we have now! *wink* > As a function begins exec

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Chris Angelico
On Mon, Dec 6, 2021 at 2:56 AM Steven D'Aprano wrote: > > > What sort of "behave differently" do you think would prevent us from > > > introspecting the function object? "Differently" from what? > > > > Wrapping it in a function means the walrus would assign in that > > function's context, not the

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Steven D'Aprano
On Sun, Dec 05, 2021 at 01:19:08PM +1100, Chris Angelico wrote: > > And if you still think that we should care, we can come up with a more > > complex trigger condition: > > > > - the parameter was flagged as using a late-default; > > - AND the default is a LB function. > > > > Problem solved. Now

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Steven D'Aprano
On Wed, Dec 01, 2021 at 12:26:33PM +, Matt del Valle wrote: > Steven gave the following example of a function signature that would be > difficult to visually parse if this proposal and arrow lambdas were > accepted: > > def process(func:List->int=>xs=>expression)->int: > > And while I agree

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Chris Angelico
On Mon, Dec 6, 2021 at 1:48 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2021-12-05 at 20:30:53 +1100, > Chris Angelico wrote: > > > On Sun, Dec 5, 2021 at 5:41 PM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > Also FWIW, I still think that if you're doing (b) or (c), then you're > > >

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Chris Angelico
On Mon, Dec 6, 2021 at 1:45 AM Steven D'Aprano wrote: > > On Sat, Dec 04, 2021 at 06:11:08PM +, Barry Scott wrote: > > > There are many possible implementation of the late bound idea that > > could create an object/default expression. But is it reasonable to > > bother with that added complexi

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread 2QdxY4RzWzUUiLuE
On 2021-12-05 at 20:30:53 +1100, Chris Angelico wrote: > On Sun, Dec 5, 2021 at 5:41 PM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > Also FWIW, I still think that if you're doing (b) or (c), then you're > > *not* doing default values anymore, you're moving pieces of the logic or > > the design

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Steven D'Aprano
On Sat, Dec 04, 2021 at 06:11:08PM +, Barry Scott wrote: > There are many possible implementation of the late bound idea that > could create an object/default expression. But is it reasonable to > bother with that added complexity/maintenance burden for a first > implementation. I don't th

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Chris Angelico
On Sun, Dec 5, 2021 at 9:58 PM Barry Scott wrote: >> def inner(timestamp=>time.time()): > >if timestamp is None: timestamp = time.time() > > > And, obviously, if you end up needing the write the explicit check for None > there is no > advantage to using late bound default. Hmm, I wouldn't s

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Barry Scott
> On 4 Dec 2021, at 21:21, Chris Angelico wrote: > > On Sun, Dec 5, 2021 at 5:29 AM Barry Scott > wrote: >> >> >> >>> On 1 Dec 2021, at 06:16, Chris Angelico wrote: >>> >>> I've just updated PEP 671 https://www.python.org/dev/peps/pep-0671/ >>> with some add

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Stephen J. Turnbull
Chris Angelico writes: > On Sun, Dec 5, 2021 at 3:08 PM Stephen J. Turnbull > wrote: > > This one is Worth Doing Right the first time, I think. And IMO David > > Mertz is right: doing it right means a more general deferred-evaluation > > object (not to be confused with Deferreds that need t

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2021-12-05 Thread Chris Angelico
On Sun, Dec 5, 2021 at 5:41 PM <2qdxy4rzwzuui...@potatochowder.com> wrote: > Also FWIW, I still think that if you're doing (b) or (c), then you're > *not* doing default values anymore, you're moving pieces of the logic or > the design into the wrong place. One example of (b) goes something like >