[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 “extreme

[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 this

[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 Eng

[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 generalizin

[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 b

[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 func

[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 Simon de Vlieger
On Mon, May 2, 2022, at 7:03 AM, Chris Angelico wrote: > The "alternate alphabet" case can be done by base converting and then > replacing on the string. It's not the smoothest, so that counts a bit > of clunkiness; but it's also not all THAT common (I can recall doing > it for SteamGuard 2FA codes

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

2022-05-01 Thread Serhiy Storchaka
02.05.22 08:03, Chris Angelico пише: Let's not go as far as a PEP yet, and figure out a couple of things: A PEP is necessary if we add Roman numerals and Cyrillic numerals, and Babylonian cuneiform numerals to the heap. ___ Python-ideas mailing lis

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

2022-05-01 Thread Chris Angelico
On Mon, 2 May 2022 at 16:37, Simon de Vlieger wrote: > > On Mon, May 2, 2022, at 7:03 AM, Chris Angelico wrote: > > The "alternate alphabet" case can be done by base converting and then > > replacing on the string. It's not the smoothest, so that counts a bit > > of clunkiness; but it's also not a

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

2022-05-01 Thread Chris Angelico
On Mon, 2 May 2022 at 16:46, Serhiy Storchaka wrote: > > 02.05.22 08:03, Chris Angelico пише: > > Let's not go as far as a PEP yet, and figure out a couple of things: > > A PEP is necessary if we add Roman numerals and Cyrillic numerals, and > Babylonian cuneiform numerals to the heap. > I'm awar