you are viewing a single comment's thread
view the rest of the comments
[–] 12 points 2 years ago* (last edited 2 years ago) (5 children)

Python, checking in ...

return (a or b)

Parentheses aren't necessary, I just prefer them for readability.

See python documentation on boolean operators for reference. Short story is a or b is an expression that evaluates to a if a is "truthy" else b. "Falsy" is empty strings/containers, 0 and None.

  • source
  • hideshow 5 child comments
  • [–] 13 points 2 years ago (2 children)

    You need to be careful here though. You might not intend for 0 and None to mean the same thing.

  • source
  • parent
  • hideshow 2 child comments