[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-23 Thread Marc Mueller
> Bear in mind that these last ones are exactly equivalent to the "or" > operator, as they'll use the default if you have any falsy value. > variable = some_function(...) or [] Isn't that in itself a good argument in favor of (??) ? By missing to add 'is None', I would have already added a subtle

[Python-Dev] Re: PEP 505 (None-aware operators) for Python 3.11

2021-10-22 Thread Marc Mueller
Most of the discussion so far has been focused on (?.). Tbh though, I'm more interested in (??) and (??=). Just reading through code, I constantly notice boilerplate like this which could easily be substituted. variable = some_function(...) if variable is None: variable = [] # some default