[Python-ideas] Re: Auto assignment of attributes

2022-05-03 Thread Eric V. Smith
Autocarrot! -- Eric > On May 3, 2022, at 8:32 PM, Christopher Barker wrote: > >  > > Sorry - auto-correct is not my friend :-( > > -CHB > >> On Tue, May 3, 2022 at 12:07 PM Ethan Furman wrote: >> On 5/2/22 23:21, Christopher Barker wrote: >> >> > But yes, there are many use cases not sui

[Python-ideas] Re: Auto assignment of attributes

2022-05-03 Thread Christopher Barker
Sorry - auto-correct is not my friend :-( -CHB On Tue, May 3, 2022 at 12:07 PM Ethan Furman wrote: > On 5/2/22 23:21, Christopher Barker wrote: > > > But yes, there are many use cases not suited to dataclasses. The > question is how many of these would > > rap parge benefit from auto-assignin

[Python-ideas] Re: infile and outfile parameters for the input function

2022-05-03 Thread Steven D'Aprano
On Mon, May 02, 2022 at 08:23:31PM -0700, Christopher Barker wrote: > On Mon, May 2, 2022 at 11:18 AM Steven D'Aprano > > > why one couldn't just use the redirect_stdout context manager. > > > > (Plus not-yet-existing, but hopefully soon, redirect_stdin.) > > > I have no use for this but thread

[Python-ideas] Re: Auto assignment of attributes

2022-05-03 Thread Ethan Furman
On 5/2/22 23:21, Christopher Barker wrote: > But yes, there are many use cases not suited to dataclasses. The question is how many of these would > rap parge benefit from auto-assigning syntax? How did you get to "rap parge" from "reap the" ? On 5/2/22 20:32, Christopher Barker wrote: > Anyw

[Python-ideas] Re: Auto assignment of attributes

2022-05-03 Thread Pablo Alcain
On Tue, May 3, 2022 at 6:36 AM Paul Moore wrote: > On Tue, 3 May 2022 at 03:04, Steven D'Aprano wrote: > > > > On Mon, May 02, 2022 at 07:44:14PM +0100, Paul Moore wrote: > > > > > I have classes with 20+ parameters (packaging metadata). You can argue > > > that a dataclass would be better, or s

[Python-ideas] Re: Auto assignment of attributes

2022-05-03 Thread Pablo Alcain
On Mon, May 2, 2022 at 11:48 AM Steven D'Aprano wrote: > On Mon, May 02, 2022 at 10:34:56AM -0600, Pablo Alcain wrote: > > > For what it's worth, > > the choice of the `@` was because of two different reasons: first, > because > > we were inspired by Ruby's syntax (later on learned that CoffeeScr

[Python-ideas] Re: Auto assignment of attributes

2022-05-03 Thread Paul Moore
On Tue, 3 May 2022 at 03:04, Steven D'Aprano wrote: > > On Mon, May 02, 2022 at 07:44:14PM +0100, Paul Moore wrote: > > > I have classes with 20+ parameters (packaging metadata). You can argue > > that a dataclass would be better, or some other form of refactoring, > > and you may actually be righ

[Python-ideas] Re: infile and outfile parameters for the input function

2022-05-03 Thread Chris Angelico
On Tue, 3 May 2022 at 17:28, Serhiy Storchaka wrote: > > 02.05.22 22:55, sam.z.e...@gmail.com пише: > > ``` > > with open('/dev/tty', 'r+') as file: > > name = input('Name: ', infile=file, outfile=file) > > > > print(name) > > ``` > > How does it differ from just: > ``` > file.write('Nam

[Python-ideas] Re: infile and outfile parameters for the input function

2022-05-03 Thread Serhiy Storchaka
02.05.22 22:55, sam.z.e...@gmail.com пише: ``` with open('/dev/tty', 'r+') as file: name = input('Name: ', infile=file, outfile=file) print(name) ``` How does it differ from just: ``` file.write('Name: ') name = file.readline() ``` ? __