• adONis@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Lol… stupid junior-devs… in such case you should go with switch-statements instead… much cleaner.

    • Gumus@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      1 year ago

      Switch-statement (called match) was added to Python 3.10 in late 2021. This is a reasonable, albeit older style of enumerated branching.

      • vithigar@lemmy.ca
        link
        fedilink
        arrow-up
        0
        arrow-down
        1
        ·
        1 year ago

        Switch statements and differently named but similarly purposed statements have been around since the 60s. Get outta here with this “switch is a newer style because python only just got them” nonsense.

  • PeriodicallyPedantic@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    No lie, after taking about 2 weeks of my first programming course in university, I did almost exactly this, trying to make a poker game.

    I hadn’t learned about objects, or functions, or even loops. Just one big method that had an if for every hand permutation.

    I hadn’t ever been exposed to programming before, and I loved it, but I knew nothing about it. Those were the only tools I had in my toolbox, and you know what they say about how when you only have a hammer everything looks like a nail.

    I’m a professional dev now, so I really hope I grew out of it lol