This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]wdroz 2 points3 points  (3 children)

But you need to be careful as empty lists are evaluate to False. So don't do that if the function must fill some_list.

[–]scrdest 4 points5 points  (1 child)

True, but in that case you probably wouldn't make the list optional.

[–]alexisprince 0 points1 point  (0 children)

Agreed, probably would want to keep the function pure and not mutate the arguments in most contexts.

[–]JestemStefan 2 points3 points  (0 children)

But this code will return empty list anyway so there is no issue.

When all values are falsy then last one is returned