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

2022-06-23 Thread Chris Angelico
On Fri, 24 Jun 2022 at 13:26, Joao S. O. Bueno wrote: > > > > On Thu, Jun 23, 2022 at 2:53 AM Chris Angelico wrote: >> >> On Thu, 23 Jun 2022 at 11:35, Joao S. O. Bueno wrote: >> > >> > Martin Di Paola wrote: >> > > Three cases: Dask/PySpark, Django's ORM and selectq. All of them >> > >

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

2022-06-23 Thread Joao S. O. Bueno
On Thu, Jun 23, 2022 at 2:53 AM Chris Angelico wrote: > On Thu, 23 Jun 2022 at 11:35, Joao S. O. Bueno > wrote: > > > > Martin Di Paola wrote: > > > Three cases: Dask/PySpark, Django's ORM and selectq. All of them > > > implement deferred expressions but all of them "compute" them in very > > >

[Python-ideas] Re: dataclass field argument to allow converting value on init

2022-06-23 Thread Thomas Kehrenberg
This is what attrs' converter functionality is, right? https://www.attrs.org/en/stable/init.html#converters ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org

[Python-ideas] Re: dataclass field argument to allow converting value on init

2022-06-23 Thread Steve Jorgensen
Sorry for typos. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at

[Python-ideas] Re: dataclass field argument to allow converting value on init

2022-06-23 Thread Steve Jorgensen
Dexter Hill wrote: > The idea is to have a `default_factory` like argument (either in the `field` > function, or a new function entirely) that takes a function as an argument, > and that function, with the value provided by `__init__`, is called and the > return value is used as the value for

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

2022-06-23 Thread Barry
> On 23 Jun 2022, at 08:27, Stephen J. Turnbull > wrote: > > Barry Scott writes: > >> I can think of ways to implement evaluation-on-reference, but they >> all have the effect of making python slower. > > Probably. > >> The simple >> >>a = b >> >> will need to slow down so that the

[Python-ideas] Re: dataclass field argument to allow converting value on init

2022-06-23 Thread Dexter Hill
Interesting point, it's not something I thought of. One solution as mentioned by Simão, and what I had in mind, is to pull the type from the first parameter of the function. We know that the function is always going to have minumum 1 parameter, and the value is always passed as the first

[Python-ideas] Re: dataclass field argument to allow converting value on init

2022-06-23 Thread Simão Afonso
On 2022-06-23 00:03:03, Paul Bryan wrote: > What type hint will be exposed for the __init__ parameter? Clearly, > it's not a `str` type in your example; you're passing it an `int` value > in your example. Presumably to overcome this, you'd need yet another > `field` function parameter to provide

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

2022-06-23 Thread Stephen J. Turnbull
Barry Scott writes: > I can think of ways to implement evaluation-on-reference, but they > all have the effect of making python slower. Probably. > The simple > > a = b > > will need to slow down so that the object in b can checked to see > if it need evaluating. No, it doesn't.

[Python-ideas] Re: dataclass field argument to allow converting value on init

2022-06-23 Thread Paul Bryan
What type hint will be exposed for the __init__ parameter? Clearly, it's not a `str` type in your example; you're passing it an `int` value in your example. Presumably to overcome this, you'd need yet another `field` function parameter to provide the type hint for the `__init__` param? On Wed,