Re: [Python-Dev] PEP 484

2018-07-04 Thread Greg Ewing
Shawn Chen wrote: The PEP 484 is proposing a type hint which can annotate the type of each parameters. How ever code written in this format can not be run for python3.5 and below. You're a bit late. Parameter annotations have been a part of the language since at least 3.1. PEP 484 just codifie

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Terry Reedy
On 7/4/2018 2:32 PM, Sven R. Kunze wrote: Sorry for adding yet another mail. :-( On 04.07.2018 10:54, Serhiy Storchaka wrote: Sorry, this PEP was rewritten so many times that I missed your Appendix. while total != (total := total + term):     term *= mx2 / (i*(i+1))     i += 2 return total

Re: [Python-Dev] PEP 572 semantics: all capabilities of the assignment statement

2018-07-04 Thread Guido van Rossum
Let me be slightly contrarian. :-) On Wed, Jul 4, 2018 at 9:12 PM Chris Angelico wrote: > Definitely against augmentation, for several reasons: > > 1) Spelling - should it be :+= or +:= ? > That one's easy. As Nick's (withdrawn) PEP 577 shows it should be simply `+=`. > 2) Is the result of th

Re: [Python-Dev] PEP 572 semantics: all capabilities of the assignment statement

2018-07-04 Thread Chris Angelico
On Thu, Jul 5, 2018 at 3:15 PM, Guido van Rossum wrote: > Let me be slightly contrarian. :-) > > On Wed, Jul 4, 2018 at 9:12 PM Chris Angelico wrote: >> 2) Is the result of the expression the modified value or the original? > > Someone (sadly I forget who) showed, convincingly (to me anyways :-)

Re: [Python-Dev] Examples for PEP 572

2018-07-04 Thread Terry Reedy
On 7/4/2018 3:34 PM, Steven D'Aprano wrote: On Wed, Jul 04, 2018 at 03:24:08PM -0400, Terry Reedy wrote: On 7/4/2018 9:35 AM, Steven D'Aprano wrote: On Wed, Jul 04, 2018 at 05:02:07PM +1000, Chris Angelico wrote: On Wed, Jul 4, 2018 at 4:07 PM, Serhiy Storchaka wrote: "Assignment is a stat

Re: [Python-Dev] PEP 572, VF/B, and "Shark Jumping"

2018-07-04 Thread Steven D'Aprano
On Thu, Jul 05, 2018 at 05:33:50AM +0300, Ivan Pozdeev via Python-Dev wrote: > And https://mail.python.org/pipermail/python-dev/2018-June/154160.html > disproves the "chosen often these days in new languages". Ivan, I think you may have linked to the wrong page. That page was Chris kindly refer

Re: [Python-Dev] Assignment expression and coding style: the while True case

2018-07-04 Thread Serhiy Storchaka
05.07.18 01:51, Victor Stinner пише: == Pattern 1, straighforward == while True: line = input.readline() if not line: break ... IMHO here assingment expression is appropriate here. The code remains straighfoward to read. while (line := input.readline()): ... We a

Re: [Python-Dev] Assignment expression and coding style: the while True case

2018-07-04 Thread Serhiy Storchaka
05.07.18 03:03, Victor Stinner пише: +labels = [slabel for label + in self._file.readline()[1:].split(b',') + if (slabel := label.strip())] labels = [slabel for label in self._file.readli

Re: [Python-Dev] Assignment expression and coding style: the while True case

2018-07-04 Thread Steven D'Aprano
On Thu, Jul 05, 2018 at 12:51:37AM +0200, Victor Stinner wrote: > I propose to start the discussion about "coding style" (where are > assignment expressions appropriate or not?) with the "while True" > case. We don't even have an official implementation yet, and you already want to start prescri

<    1   2