
July 18, 2023
5:08 a.m.
On Tue, 18 Jul 2023 at 19:02, Dom Grigonis <dom.grigonis@gmail.com> wrote:
Thank you.
I meant “superset of 671, not 505”…
One question:
def bar(a => None); return foo(a)
def foo(a => object()): return a
How would I force foo’s default from bar’s call?
That's a known-hard problem. The best way is probably to use *a,**kw and only pass the args you get, but that doesn't always work.
Would something like this work?
def foo(a => object() if a is None else a): return a
Yyyyyyes, but now you're defining that a could be None, so you may as well go with the classic idiom: def foo(a=None): if a is None: a = object() The point of default argument expressions is that you DON'T need to accept a fake default. ChrisA