Re: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-20 Thread Sam Ezeh
I'll see if I can find out how positional only and keyword only arguments are used in __init__ methods in the wild and I'll see if there have been any other discussions talking about what this approach could offer. On Sun, 17 Apr 2022 at 02:54, dn wrote: > > On 17/04/2022 09.20, Sam Ezeh wrote: >

Re: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-16 Thread dn
On 17/04/2022 09.20, Sam Ezeh wrote: >> Perhaps I'm missing the point, but what functionality or advantage(s) >> does this give, over data-classes? > > One advantage is maintaining control over the __init__ function without > having to write extra code to do so. In the linked discussion from > pyt

Re: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-15 Thread Ethan Furman
On 4/15/22 04:19, Sam Ezeh wrote: Elsewhere, the idea of supporting new syntax to automatically initialise attributes provided as arguments to __init__ methods was raised. [...] Good post! You'll want to send this to python-ideas at some point (that's where most new python features are discu

Re: Proposal: Syntax for attribute initialisation in __init__ methods

2022-04-15 Thread dn
On 15/04/2022 23.19, Sam Ezeh wrote: ... Kudos for doing the research! > Some related implementations are attrs, dataclasses and the use of a > decorator. And there's potentially a point to be raised that the results > from the first query indicate that the @dataclasse decorator is not being > u