Revisiting PEP 505

It seems like there’s fair support for ?? while the others are more controversial. I think ?. might have its use case but understanding the behavior (when it raises and doesn’t) could be confusing. I probably wouldn’t use it in my code.

Perhaps scoping the PEP to just ?? ? A great use-case is function arguments. Instead of two lines of boilerplate we have one! I’m not fond of the ??= though.

def somefn(action_list=None):
    if action_list is None:
        action_list = ["copy"]
    do_some_stuff(action_list)

def somefn(action_list=None):
    action_list = action_list ?? ["copy"]
    do_some_stuff(action_list)
3 Likes