szmer
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
hypertown@lemmy.world to Programmer Humor@lemmy.ml · 2 years ago

I like Python def

lemmy.world

message-square
59
fedilink
428

I like Python def

lemmy.world

hypertown@lemmy.world to Programmer Humor@lemmy.ml · 2 years ago
message-square
59
fedilink
alert-triangle
You must log in or # to comment.
  • Reinsch@feddit.de
    link
    fedilink
    arrow-up
    63
    ·
    2 years ago

    Ewww default exports. Explicit named exports are better! And so it begins

    • 👍Maximum Derek👍@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      20
      ·
      2 years ago

      How very dare you share my opinion!

    • ShortFuse@lemmy.world
      link
      fedilink
      arrow-up
      17
      ·
      edit-2
      2 years ago

      PascalCase default exports for Classes

      camelCase named exports for functions

      ALL_CAPS named exports for constants

  • the_beber@lemm.ee
    link
    fedilink
    arrow-up
    39
    arrow-down
    1
    ·
    2 years ago

    How about some fun?

    • Andrew@mander.xyz
      link
      fedilink
      arrow-up
      27
      ·
      2 years ago

      How about some fn instead?

      • MultipleAnimals@sopuli.xyz
        link
        fedilink
        arrow-up
        16
        ·
        edit-2
        2 years ago
        pub async fn foo() -> Pin>>>>>
        

        oh fuck commonmark cant display the syntax :( well anyone who has done async rust can imagine

        • flashgnash@lemm.ee
          link
          fedilink
          arrow-up
          5
          ·
          2 years ago

          p a f fn(){}

        • AVincentInSpace@pawb.social
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          2 years ago

          Pin<Box<dyn Future<Output=Result<AsyncResponseThatYouWillHaveToAwaitAgain<ActualResultType>, InscrutableErrorTypeThatDoesntImplementDisplay>> + Send + Sync + 'static + 20MillionMoreAutoTraits>>

          • MultipleAnimals@sopuli.xyz
            link
            fedilink
            arrow-up
            2
            ·
            1 year ago

            Exactly, now we are talking

      • Xylight (Photon dev)@lemmy.xylight.dev
        link
        fedilink
        English
        arrow-up
        12
        ·
        2 years ago

        these puns are getting funcy

      • ______@lemm.ee
        link
        fedilink
        arrow-up
        2
        ·
        2 years ago

        Chef’s kiss 👌

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

        So much better

    • sbv@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      20
      arrow-down
      2
      ·
      2 years ago

      fun is the punchable face of keywords. I don’t know why, but I hate it.

      • pivot_root@lemmy.world
        link
        fedilink
        arrow-up
        13
        ·
        2 years ago

        Oh, you’re no fun.

        ^I’ll see myself out.^

      • SubArcticTundra@lemmy.ml
        link
        fedilink
        arrow-up
        5
        ·
        2 years ago

        I prefer good old def

    • autokludge@programming.dev
      link
      fedilink
      English
      arrow-up
      11
      ·
      2 years ago

      How about some (defun)?

    • darcy@sh.itjust.works
      link
      fedilink
      arrow-up
      5
      ·
      2 years ago

      better than function

    • macniel@feddit.de
      link
      fedilink
      arrow-up
      3
      ·
      2 years ago

      Kotlin?

      • the_beber@lemm.ee
        link
        fedilink
        arrow-up
        2
        ·
        2 years ago

        Yes

  • boletus@sh.itjust.works
    link
    fedilink
    arrow-up
    38
    arrow-down
    1
    ·
    2 years ago

    Python is fine as a language I guess

    But python programmers give it a bad name. I’ve never seen “well written” python code, it’s always shit that’s been thrown together cos it works.

    • herrvogel@lemmy.world
      link
      fedilink
      arrow-up
      18
      ·
      2 years ago

      I use python exclusively when I want to quickly throw some shit together that nobody’s ever gonna spend any time maintaining, so that tracks.

    • MrBlueSkies@feddit.uk
      link
      fedilink
      arrow-up
      17
      ·
      2 years ago

      It badly needs strong typing. And braces.

      • Anahkiasen@lemmy.blahaj.zone
        link
        fedilink
        English
        arrow-up
        6
        ·
        2 years ago

        Doesn’t Python 3 have types? I’ve seen a few well typed codebases and it really made the code much easier to understand. Or is it just that it’s not checking them strongly enough?

        • kaesaecracker@leminal.space
          link
          fedilink
          English
          arrow-up
          5
          ·
          2 years ago

          The type annotations are just fancy comments. They do not do anything at runtime. If you have a function that takes an int someone can still pass in a list or anything else.

          • boletus@sh.itjust.works
            link
            fedilink
            arrow-up
            3
            ·
            2 years ago

            The main advantage of typing for me is static linting.

          • Anahkiasen@lemmy.blahaj.zone
            link
            fedilink
            arrow-up
            2
            ·
            edit-2
            2 years ago

            But will it run? I’m used to typescript where it’s not checked at runtime but you can’t “build” unsafe types I’d assume it’s the same here

            • AVincentInSpace@pawb.social
              link
              fedilink
              arrow-up
              1
              ·
              edit-2
              2 years ago

              no they really are just fancy comments. You can do runtime reflection on them if you wanna make something fancy like a plugin system but that’s about it

      • funkless_eck@sh.itjust.works
        link
        fedilink
        arrow-up
        4
        ·
        2 years ago

        just put int_ or str_ in front of your variables

        problem solved 😌

      • boletus@sh.itjust.works
        link
        fedilink
        arrow-up
        4
        ·
        2 years ago

        I think python is good as it is for what it can do, mostly because I have no reason to use it.

        What we need is lua with types!

        • Shush@reddthat.com
          link
          fedilink
          arrow-up
          4
          arrow-down
          1
          ·
          2 years ago

          Have you heard of Typescript-to-lua? I used to do Dota modding (which is in lua) with TSTL and it works great!

          You write TS code (using Typescript syntax that includes types) and it is compiled into lua.

          Wonder if that could be an alternative that can work for you.

          • boletus@sh.itjust.works
            link
            fedilink
            arrow-up
            2
            ·
            2 years ago

            That sounds pretty neat thank you. At some point lua had an official typed extension that is no longer maintained unfortunately. Hopefully there’s a stable fork one day.

            • Shush@reddthat.com
              link
              fedilink
              arrow-up
              1
              ·
              2 years ago

              Oh yeah, I heard it was poorly recieved. The syntax wasn’t great and generally the support sucked. AFAIK there is no progress on types for lua.

  • redcalcium@lemmy.institute
    link
    fedilink
    arrow-up
    15
    ·
    2 years ago

    When the grey beards wake up they’re going to be fuming

  • HStone32@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    int main() {}

    Seriously. why isn’t there any C love around here?

  • The Gay Tramp@lemmy.ca
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    9
    ·
    2 years ago

    Who doesn’t use arrow functions?

    • marwwin@suppo.fi
      link
      fedilink
      arrow-up
      32
      arrow-down
      1
      ·
      2 years ago

      Arrow functions should be used only for callbacks. I hate that people has started defining named functions with arrow functions in JS. Arrow functions are not hoisted and the ordering of your functions is going to get wonky, because you need to define all you functions first before composing them, when it should be the other way around. Start with the most high-level function which calls lower level functions.

      • Paradoxvoid@aussie.zone
        link
        fedilink
        English
        arrow-up
        7
        arrow-down
        1
        ·
        2 years ago

        I had this exact fight with my team several months ago, and lost to popular opinion since the rest of my team are either zoomers or indifferent.

        • JonEFive@midwest.social
          link
          fedilink
          arrow-up
          3
          ·
          2 years ago

          I’ve reached the point that I cringe at the mention of arrow functions because so many people seem to always want to use arrow functions.

          Like I’m looking up something on stack overflow and half the answers are arrow functions that are that way for no other reason than to use the fun little =>

        • xmunk@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          2 years ago

          All good programming teams are run as benevolent dictatorships for precisely this kind of reason.

    • Cargon@lemmy.ml
      link
      fedilink
      arrow-up
      14
      ·
      2 years ago
      sum(your_mom &lt;- rep(69, 420))
      
      • pivot_root@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        2 years ago

        R?

      • JonEFive@midwest.social
        link
        fedilink
        arrow-up
        2
        ·
        2 years ago

        NaN

        your_mom is undefined

        • Cargon@lemmy.ml
          link
          fedilink
          arrow-up
          2
          ·
          2 years ago

          It’s being assigned and passed to sum at the same time. One of the many entertaining quirks of R.

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

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: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

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

  • 240 users / day
  • 628 users / week
  • 1.64K users / month
  • 9.66K users / 6 months
  • 42 local subscribers
  • 35.6K subscribers
  • 1.83K Posts
  • 36.6K Comments
  • Modlog
  • mods:
  • AgreeableLandscape@lemmy.ml
  • cat_programmer@lemmy.ml
  • BE: 0.19.6
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org