[Python-Dev] (name := expression) doesn't fit the narrative of PEP 20 (original) (raw)
Terry Reedy tjreedy at udel.edu
Thu Apr 26 14:54:20 EDT 2018
- Previous message (by thread): [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20
- Next message (by thread): [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 4/26/2018 6:20 AM, Steve Holden wrote:
On Thu, Apr 26, 2018 at 8:56 AM, Steven D'Aprano <steve at pearwood.info_ _<mailto:steve at pearwood.info>> wrote:
On Thu, Apr 26, 2018 at 03:31:13AM -0400, Terry Reedy wrote: > On 4/25/2018 8:20 PM, Chris Angelico wrote: > >On Thu, Apr 26, 2018 at 10:11 AM, Yury Selivanov > ><yselivanov.ml at gmail.com <mailto:yselivanov.ml at gmail.com>> wrote: > >>Just yesterday this snippet was used on python-dev to show how great the > >>new syntax is: > >> > >> myfunc(arg, buffer=(buf := [None]*getsize()), size=len(buf)) > > What strikes me as awful about this example is that len(buf) is > getsize(), so the wrong value is being named and saved. > 'size=len(buf)' is, in a sense, backwards. Terry is absolutely right, and I'm to blame for that atrocity. Mea culpa. Perhaps a better spelling would be myfunc(arg, buffer=[None]*(buflen := getsize()), size=buflen)
That is exactly what I wrote in the continuation that Steven snipped.
-- Terry Jan Reedy
- Previous message (by thread): [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20
- Next message (by thread): [Python-Dev] (name := expression) doesn't fit the narrative of PEP 20
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]