[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread Chris Angelico
On Wed, 22 Jun 2022 at 11:59, David Mertz, Ph.D. wrote: > > Thanks Carl and Chris. After reading your comments, and thinking some more > about it, I agree you are both correct that it only makes sense to have a > DeferredObject act like a closure in the scope of its creation. That really > sh

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread David Mertz, Ph.D.
Thanks Carl and Chris. After reading your comments, and thinking some more about it, I agree you are both correct that it only makes sense to have a DeferredObject act like a closure in the scope of its creation. That really should suffice for anything I could sensibly want; it's enough for Dask,

[Python-ideas] Re: Add a line_offsets() method to str

2022-06-21 Thread Inada Naoki
On Tue, Jun 21, 2022 at 3:49 AM Marco Sulla wrote: > > On Sun, 19 Jun 2022 at 03:06, Inada Naoki wrote: > > FWIW, I had proposed str.iterlines() to fix incompatibility between > > IO.readlines() and str.splitlines(). > > It's a good idea IMHO. In your mind, str.iterlines() will find only > \n, \r

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread Carl Meyer via Python-ideas
On Tue, Jun 21, 2022 at 4:55 PM David Mertz, Ph.D. wrote: > I haven't gotten to writing that into the PEP yet, but I think the rule > has to be to take the scope of evaluation not the scope of definition. I > know it needs to be there, and I'm just thinking about helpful examples. > > Which is t

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread Chris Angelico
On Wed, 22 Jun 2022 at 08:54, David Mertz, Ph.D. wrote: > > I haven't gotten to writing that into the PEP yet, but I think the rule has > to be to take the scope of evaluation not the scope of definition. I know it > needs to be there, and I'm just thinking about helpful examples. > > Which is

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread David Mertz, Ph.D.
I haven't gotten to writing that into the PEP yet, but I think the rule has to be to take the scope of evaluation not the scope of definition. I know it needs to be there, and I'm just thinking about helpful examples. Which is to say the semantics are more like `eval()` than like a lambda closure

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread Chris Angelico
On Wed, 22 Jun 2022 at 08:36, Carl Meyer wrote: > > > > On Tue, Jun 21, 2022 at 4:28 PM Chris Angelico wrote: >> >> On Wed, 22 Jun 2022 at 08:21, Carl Meyer via Python-ideas >> wrote: >> > >> > >> > >> > On Tue, Jun 21, 2022 at 4:10 PM David Mertz, Ph.D. >> > wrote: >> >> >> >> On Tue, Jun 21,

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread Carl Meyer via Python-ideas
On Tue, Jun 21, 2022 at 4:28 PM Chris Angelico wrote: > On Wed, 22 Jun 2022 at 08:21, Carl Meyer via Python-ideas > wrote: > > > > > > > > On Tue, Jun 21, 2022 at 4:10 PM David Mertz, Ph.D. < > david.me...@gmail.com> wrote: > >> > >> On Tue, Jun 21, 2022 at 5:53 PM Brendan Barnwell > wrote: > >

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread Chris Angelico
On Wed, 22 Jun 2022 at 08:21, Carl Meyer via Python-ideas wrote: > > > > On Tue, Jun 21, 2022 at 4:10 PM David Mertz, Ph.D. > wrote: >> >> On Tue, Jun 21, 2022 at 5:53 PM Brendan Barnwell >> wrote: >>> >>> > In the example, we assume that the built-in function `type()` is special >>> > in not

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread Carl Meyer via Python-ideas
On Tue, Jun 21, 2022 at 4:10 PM David Mertz, Ph.D. wrote: > On Tue, Jun 21, 2022 at 5:53 PM Brendan Barnwell > wrote: > >> > In the example, we assume that the built-in function `type()` is special >> > in not counting as a reference to the binding for purpose of realizing a >> > computation. Al

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread David Mertz, Ph.D.
On Tue, Jun 21, 2022 at 5:53 PM Brendan Barnwell wrote: > > In the example, we assume that the built-in function `type()` is special > > in not counting as a reference to the binding for purpose of realizing a > > computation. Alternately, some new special function like `isdeferred()` > might be

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

2022-06-21 Thread Brendan Barnwell
On 2022-06-20 22:54, Chris Angelico wrote: You are welcome to dislike the PEP on the basis that the existing language is better than it would be with this feature. I personally disagree, but that's what opinions are. But to object on the mere basis that something MIGHT, despite demonstrated evide

[Python-ideas] Re: Generalized deferred computation in Python

2022-06-21 Thread Brendan Barnwell
On 2022-06-21 13:53, David Mertz, Ph.D. wrote: In the example, we assume that the built-in function `type()` is special in not counting as a reference to the binding for purpose of realizing a computation. Alternately, some new special function like `isdeferred()` might be used to check for ``Def

[Python-ideas] Generalized deferred computation in Python

2022-06-21 Thread David Mertz, Ph.D.
Here is a very rough draft of an idea I've floated often, but not with much specification. Take this as "ideas" with little firm commitment to details from me. PRs, or issues, or whatever, can go to https://github.com/DavidMertz/peps/blob/master/pep-.rst as well as mentioning them in this thre

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

2022-06-21 Thread David Mertz, Ph.D.
I will post to a different thread for my actual semi-proposal. But to answer the claim that late-bound arg defaults and late-bound everything-else are unrelated, and to start with an early version of what I'd actually want, I wrote this: https://github.com/DavidMertz/peps/blob/master/pep-.rst

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

2022-06-21 Thread Paul Moore
On Tue, 21 Jun 2022 at 10:01, Paul Moore wrote: > PS To be clear, my objections to the PEP aren't based on deferred > evaluation. So I'm an impartial 3rd party on this matter. I *do* have > problems with the PEP, so I have an interest in seeing the PEP fairly > reflect the lack of consensus, and

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

2022-06-21 Thread Paul Moore
On Tue, 21 Jun 2022 at 09:20, Chris Angelico wrote: > > On Tue, 21 Jun 2022 at 18:15, Paul Moore wrote: > > I'm not talking about a "full and detailed specification". That's > > *still* more than is needed for a valid debate (at this point). But > > what *is* needed is a more complete explanation

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

2022-06-21 Thread Chris Angelico
On Tue, 21 Jun 2022 at 18:15, Paul Moore wrote: > I'm not talking about a "full and detailed specification". That's > *still* more than is needed for a valid debate (at this point). But > what *is* needed is a more complete explanation of how deferred > evaluation would work, and some plausible (n

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

2022-06-21 Thread Paul Moore
On Tue, 21 Jun 2022 at 06:27, Chris Angelico wrote: > > Okay, here's a compromise. > > Go and write a full and detailed specification of the Python-visible > semantics of deferred evaluation objects, including how they would be > used to implement late-bound argument defaults. I'm going to ignore