>> How about this? >> args = args or [] > > With this one, you will build a new list when args is an empty list, which is unnecessary.
Indeed, but personally I appreciate it's brevity, compared with a 2-line 'if' statement.
Just occurred to me this one line alternative, but it's still not as neat: args = [] if args is None else args
« Back to merge proposal
>> How about this?
>> args = args or []
>
> With this one, you will build a new list when args is an empty list, which is unnecessary.
Indeed, but personally I appreciate it's brevity, compared with a 2-line 'if' statement.
Just occurred to me this one line alternative, but it's still not as neat:
args = [] if args is None else args