[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-11-25 Thread Chris Angelico
On Fri, Nov 26, 2021 at 6:22 PM Abdulla Al Kathiri wrote: > > Chris, > > Will we able to use late-bound arguments in dataclass when it’s creating the > __init__ function? > > @dataclass > class C: > x: int > y: int > ls: list[int] => [x, y] > With that syntax, no, because there's no

[Python-ideas] Re: PEP 671: Syntax for late-bound function argument defaults

2021-11-25 Thread Abdulla Al Kathiri
Chris, Will we able to use late-bound arguments in dataclass when it’s creating the __init__ function? @dataclass class C: x: int y: int ls: list[int] => [x, y] > On 10 Nov 2021, at 11:25 AM, Chris Angelico wrote: > > On Wed, Nov 10, 2021 at 6:02 PM Christopher Barker

[Python-ideas] Re: Should bare logical comparisons raise a warning?

2021-11-25 Thread Chris Angelico
On Fri, Nov 26, 2021 at 12:02 PM Rob Cliffe via Python-ideas wrote: > On 26/11/2021 00:12, Steven D'Aprano wrote: > > Personally, I think that this is the right design. People can pick and > > choose which, if any, linter they use, and how strict they want it to > > be. But I can also understand t

[Python-ideas] Re: Should bare logical comparisons raise a warning?

2021-11-25 Thread Rob Cliffe via Python-ideas
On 26/11/2021 00:12, Steven D'Aprano wrote: On Wed, Nov 24, 2021 at 07:15:58PM -, ehmatt...@gmail.com wrote: One common error that I haven't seen discussed is bare logical comparisons. They're syntactically legal so they don't raise errors, but I have never seen a real-world use case for

[Python-ideas] Re: Should bare logical comparisons raise a warning?

2021-11-25 Thread Steven D'Aprano
On Wed, Nov 24, 2021 at 07:15:58PM -, ehmatt...@gmail.com wrote: > One common error that I haven't seen discussed is bare logical > comparisons. They're syntactically legal so they don't raise errors, > but I have never seen a real-world use case for one. You've never used the interactive i

[Python-ideas] Re: easier writing to multiple streams

2021-11-25 Thread Cameron Simpson
On 24Nov2021 19:26, Eyal Gruss wrote: >i find myself changing all my >print()'s to custom myprint()'s. Had you tried: from myutils import myprint as print I've got a terminal status line module (cs.upd), and to print things one needs to withdraw the status lines, run the normal print(), re

[Python-ideas] Re: easier writing to multiple streams

2021-11-25 Thread Christopher Barker
On Thu, Nov 25, 2021 at 9:52 AM Barry wrote: > You can replace sys.stdout with your own object that prints to a list of > streams. > I have used this in the past. > I think was essentially the OP's suggestion #4: 4. add to the standard io library a new class which gives you the write > interfac

[Python-ideas] Re: easier writing to multiple streams

2021-11-25 Thread Finn Mason
On Thu, Nov 25, 2021, 6:06 AM Eyal Gruss wrote: > hi > > first post here :) > i have a recurring use pattern where i want to save to file everything i > print to the screen. i have used the standard logging module and found it > too cumbersome for my simple use case, and i find myself changing al

[Python-ideas] Re: Should bare logical comparisons raise a warning?

2021-11-25 Thread Christopher Barker
On Thu, Nov 25, 2021 at 9:51 AM Barry wrote: > > One common error that I haven't seen discussed is bare logical > comparisons. They're syntactically legal so they don't raise errors, but I > have never seen a real-world use case for one. nor have I. However, this strikes me as very much a probl

[Python-ideas] Re: easier writing to multiple streams

2021-11-25 Thread Barry
> On 25 Nov 2021, at 13:07, Eyal Gruss wrote: > >  > hi > > first post here :) > i have a recurring use pattern where i want to save to file everything i > print to the screen. i have used the standard logging module and found it too > cumbersome for my simple use case, and i find myself cha

[Python-ideas] Re: Should bare logical comparisons raise a warning?

2021-11-25 Thread Barry
> On 25 Nov 2021, at 13:06, ehmatt...@gmail.com wrote: > > Hi everyone, > > I've been really impressed by the recent improvements to error messages in > Python 3.10. The specific suggestions in some error messages are going to > save countless hours of people's time. The benefits for beginner

[Python-ideas] easier writing to multiple streams

2021-11-25 Thread Eyal Gruss
hi first post here :) i have a recurring use pattern where i want to save to file everything i print to the screen. i have used the standard logging module and found it too cumbersome for my simple use case, and i find myself changing all my print()'s to custom myprint()'s. i am interested in sug

[Python-ideas] Should bare logical comparisons raise a warning?

2021-11-25 Thread ehmatthes
Hi everyone, I've been really impressed by the recent improvements to error messages in Python 3.10. The specific suggestions in some error messages are going to save countless hours of people's time. The benefits for beginners are fairly obvious. But even for experienced programmers, the diffe