• SatyrSack@lemmy.sdf.org
    link
    fedilink
    arrow-up
    0
    ·
    5 days ago

    Are you just referring to how Python uses the English and/or instead of the more common &&/||? I think what the user above you was talking about was Lua’s strange ternary syntax using and/or.

    • lime!@feddit.nu
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      4 days ago

      no, the lbnked table shows how python also returns the first non-falsey result of an a or b expression rather than just giving a boolean. it’s useful for initialising optional reference args:

      def foo(a: list = None)
          a = a or []
      

      works with and as well.