maegul, (edited )
@maegul@lemmy.ml avatar

Python, checking in …


<span style="font-weight:bold;color:#a71d5d;">return </span><span style="color:#323232;">(a </span><span style="font-weight:bold;color:#a71d5d;">or </span><span style="color:#323232;">b)
</span>

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.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • wartaberita
  • random
  • uselessserver093
  • Food
  • aaaaaaacccccccce
  • [email protected]
  • test
  • CafeMeta
  • testmag
  • MUD
  • RhythmGameZone
  • RSS
  • dabs
  • TheResearchGuardian
  • Ask_kbincafe
  • KbinCafe
  • Testmaggi
  • Socialism
  • feritale
  • oklahoma
  • SuperSentai
  • KamenRider
  • All magazines