26 Apr
2018
26 Apr
'18
3:20 a.m.
On Thu, Apr 26, 2018 at 8:56 AM, Steven D'Aprano
On 4/25/2018 8:20 PM, Chris Angelico wrote:
On Thu, Apr 26, 2018 at 10:11 AM, Yury Selivanov
wrote: Just yesterday this snippet was used on python-dev to show how great
On Thu, Apr 26, 2018 at 03:31:13AM -0400, Terry Reedy wrote: the
new syntax is:
my_func(arg, buffer=(buf := [None]*get_size()), size=len(buf))
What strikes me as awful about this example is that len(buf) is get_size(), 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
my_func(arg, buffer=[None]*(buflen := get_size()), size=buflen) [...]