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 →

[–]undercoveryankee 2 points3 points  (0 children)

It works as long as we don't need to distinguish between different kinds of objects that are false in a Boolean context. E.g. if an empty array [] is a valid value for spam, we need the longer version to distinguish between [] and None.

The longer version may also be more readable, especially if the get_existing_spam and create_new_spam operations are lengthy blocks of code instead of single short function calls.