This doesn't cut it
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Maven (famous)@lemmy.zip to Programmer Humor@programming.dev · 2 days ago

Modern Programming

lemmy.zip

message-square
74
fedilink
565

Modern Programming

lemmy.zip

Maven (famous)@lemmy.zip to Programmer Humor@programming.dev · 2 days ago
message-square
74
fedilink
  • oni ᓚᘏᗢ@lemmy.world
    link
    fedilink
    arrow-up
    11
    ·
    2 days ago

    I love something = condition and result1 or result2 in lua

    • Randelung@lemmy.world
      link
      fedilink
      arrow-up
      10
      ·
      edit-2
      2 days ago

      Python does that, too.

      https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not

      • SatyrSack@lemmy.sdf.org
        link
        fedilink
        arrow-up
        2
        arrow-down
        1
        ·
        2 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
          6
          ·
          edit-2
          1 day ago

          no, the linked 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.

    • oni ᓚᘏᗢ@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      2 days ago

      often I do a function called elvis XD with the next signature elvis(condition, res1, res2)

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1.86K users / day
  • 5K users / week
  • 10.2K users / month
  • 18.9K users / 6 months
  • 1 local subscriber
  • 24.1K subscribers
  • 888 Posts
  • 17.6K Comments
  • Modlog
  • mods:
  • adr1an@programming.dev
  • Feyter@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.8
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org