• Captain Aggravated@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        0
        ·
        3 days ago

        AFAIK the syntax seems to be the same.

        def sayHam():
            print("Ham")
        
        sayHam()
        

        works when typed into the Python console, no class needed. I program as a hobby, I’m no expert on the language, but does Python even differentiate between functions and class methods internally? Other than just scope? There’s a possibility I’ll learn something today.

        • dreadbeef@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 days ago

          I thought python was one of those weird OOP languages like Java or C# that bound all classless methods to some universal static class but im wrong on that.

          They are out there though so be on the lookout for these languages that doesnt believe in algebra.

    • Baizey@feddit.dk
      link
      fedilink
      arrow-up
      0
      ·
      5 days ago

      Technically java would also be (){} since the modifiers are optional (outside of public static void main(String… args)) and return type is ignore for the others :D

      • RaphaelSchmitz@feddit.org
        link
        fedilink
        arrow-up
        0
        arrow-down
        1
        ·
        4 days ago

        Yeah the thing is that each part of “public static void” is a feature. Which other languages don’t have.

        Still makes a good meme for programmers who are not experienced enough to know that.