24 May
2020
24 May
'20
11:34 a.m.
On Sat, May 23, 2020 at 2:37 AM Steven D'Aprano <steve@pearwood.info> wrote:
On Thu, May 21, 2020 at 02:50:00PM +0200, Alex Hall wrote:
or a more realistic example:
def func(options=:{}):
Add annotations and walrus operator:
def flummox(options:dict=:(a:={x: None})):
and we now have *five* distinct meanings for a colon in one line.
OK, let's forget the colon. The point is just to have some kind of 'modifier' on the default value to say 'this is evaluated on each function call', while still having something that looks like `arg=<default>`. Maybe something like: def func(options=from {}):