[Python-ideas] Re: Auto assignment of attributes

2022-05-01 Thread Christopher Barker
On Sun, May 1, 2022 at 1:16 AM Steven D'Aprano wrote: > > > On Sat, Apr 23, 2022 at 12:11:07PM -0700, Christopher Barker wrote: > > > > Absolutely. However, this is not an "all Classes" question. > > > Isn't it? I thought this was a proposal to allow any class to partake > in > > > the dataclass

[Python-ideas] Re: int.to_base, int.from_base

2022-05-01 Thread Chris Angelico
On Mon, 2 May 2022 at 14:49, Simon de Vlieger wrote: > > Hey there, > > The `int()` function allows to specify a base to convert from, for example: > > >>> int("foo", 26) > 10788 > > Which is documented as: > > > The base defaults to 10. Valid bases are 0 and 2-36. > > For other common bases

[Python-ideas] int.to_base, int.from_base

2022-05-01 Thread Simon de Vlieger
Hey there, The `int()` function allows to specify a base to convert from, for example: >>> int("foo", 26) 10788 Which is documented as: > The base defaults to 10. Valid bases are 0 and 2-36. For other common bases functions exist in the base64 module in stdlib. I often need other bases, or

[Python-ideas] Re: Auto assignment of attributes

2022-05-01 Thread Devin Jeanpierre
On Sun, May 1, 2022 at 9:35 AM Ethan Furman wrote: > My own thoughts about the proposal: It seems interesting, and assigning > as-is arguments is a chore -- but I'm not sure > using up a token to help only one method per class is a good trade. > Is it unreasonable to instead suggest

[Python-ideas] Re: Auto assignment of attributes

2022-05-01 Thread Ethan Furman
On 5/1/22 00:21, Christopher Barker wrote: > On Sat, Apr 30, 2022 at 2:17 PM Pablo Alcain wrote: >> It shows that out of 20k analyzed classes in the selected libraries (including black, >> pandas, numpy, etc), ~17% of them could benefit from the usage of auto-assign syntax. > > I only read

[Python-ideas] Re: Auto assignment of attributes

2022-05-01 Thread Steven D'Aprano
On Sat, Apr 30, 2022 at 11:54:47PM -0700, Christopher Barker wrote: > On Sat, Apr 30, 2022 at 6:40 PM Steven D'Aprano wrote: > > > On Sat, Apr 23, 2022 at 12:11:07PM -0700, Christopher Barker wrote: > > > Absolutely. However, this is not an "all Classes" question. > > > > Isn't it? I thought

[Python-ideas] Re: Auto assignment of attributes

2022-05-01 Thread Christopher Barker
On Sat, Apr 30, 2022 at 2:17 PM Pablo Alcain wrote: > >>> B) Most __init__ params need specialized behavior, and are quite >> distinct from what's needed by __eq__ and __repr__ >> >> (B) is well covered by the current, you-need-to-specify-everything >> approach. >> > > I don’t see B as a

[Python-ideas] Re: Auto assignment of attributes

2022-05-01 Thread Christopher Barker
On Sat, Apr 30, 2022 at 6:40 PM Steven D'Aprano wrote: > On Sat, Apr 23, 2022 at 12:11:07PM -0700, Christopher Barker wrote: > > Absolutely. However, this is not an "all Classes" question. > > Isn't it? I thought this was a proposal to allow any class to partake in > the dataclass autoassignment