Re: Subtle difference between any(a list) and any(a generator) with Python 3.9

2021-07-29 Thread Chris Angelico
On Fri, Jul 30, 2021 at 5:40 AM Terry Reedy wrote: > Since the 'two ways' involve the new :=, I have no idea what 'two ways' > and 'same result' you mean before :=. > I'm not sure, but I think that a lot of people read patch notes as if they say "this is how everyone needs to do things now", and

Re: Subtle difference between any(a list) and any(a generator) with Python 3.9

2021-07-29 Thread Terry Reedy
On 7/29/2021 5:39 AM, Unknown wrote: Hello Reading PEP572 about Python 3.9 assignment expressions, I discovered a subtle difference between any(a list) and any(a generator) see: >>> lines = ["azerty", "#qsdfgh", "wxcvbn"] >>> any((comment := line).startswith('#') for line in lines) True >>>

Re: Subtle difference between any(a list) and any(a generator) with Python 3.9

2021-07-29 Thread Chris Angelico
On Thu, Jul 29, 2021 at 7:49 PM ast wrote: > > Hello > > Reading PEP572 about Python 3.9 assignment expressions, > I discovered a subtle difference between any(a list) > and any(a generator) > > see: > > >>> lines = ["azerty", "#qsdfgh", "wxcvbn"] > >>> any((comment := line).startswith('#') for

Subtle difference between any(a list) and any(a generator) with Python 3.9

2021-07-29 Thread ast
Hello Reading PEP572 about Python 3.9 assignment expressions, I discovered a subtle difference between any(a list) and any(a generator) see: >>> lines = ["azerty", "#qsdfgh", "wxcvbn"] >>> any((comment := line).startswith('#') for line in lines) True >>> comment "#qsdfgh" >>> any([(comment :=