Re: [Python-Dev] PEP 572: Usage of assignment expressions in C

2018-04-30 Thread Tim Peters
[Raymond Hettinger ] > Thanks Antoine, this is an important point that I hope doesn't get lost. > In a language with exceptions, assignment expressions are less needful. > Also, the pattern of having of having mutating methods return None > further limits the utility. It doesn't diminish the utili

Re: [Python-Dev] PEP 572: Usage of assignment expressions in C

2018-04-30 Thread Raymond Hettinger
> On Apr 28, 2018, at 8:45 AM, Antoine Pitrou wrote: > >> I personally haven't written a lot of C, so have no personal experience, >> but if this is at all a common approach among experienced C developers, it >> tells us a lot. > > I think it's a matter of taste and personal habit. Some peopl

Re: [Python-Dev] PEP 572: Usage of assignment expressions in C

2018-04-30 Thread Victor Stinner
2018-04-28 17:45 GMT+02:00 Antoine Pitrou : > // Read up to n bytes from file descriptor > if ((bytes_read = read(fd, buf, n)) == -1) { > // Error occurred while reading, do something > } About C, there is a popular coding style (not used by our PEP 7) for comparison: if (-1 == n)

Re: [Python-Dev] PEP 572: Usage of assignment expressions in C

2018-04-28 Thread Antoine Pitrou
On Fri, 27 Apr 2018 09:49:33 -0700 Chris Barker wrote: > On Tue, Apr 24, 2018 at 2:21 AM, Victor Stinner wrote: > > > Even if the C language allows assignments in if, I avoid them, because > > I regularly have to debug my own code in gdb ;-) > > > > I personally haven't written a lot of C, so