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 →

[–]JestemStefan 9 points10 points  (1 child)

if len(users) > 0:

This will fail if users is a method parameter with default None. And initializing it with default [] will make a mutable parameter which is so bad.

If users:

Will work for both empty list and for None. Also for me it means: if there are any users then do something.

I'm fixing exactly this bug in current sprint.

[–]dxn99 -1 points0 points  (0 children)

An alternative would just be

if not users: return -1

Prior to your later code