Please dont take this seriously guys its just a dumb meme I haven’t written a single line of code in half of these languages

  • stevedidwhat_infosec@infosec.pub
    link
    fedilink
    arrow-up
    26
    ·
    10 months ago

    Idk I still like writing my own stuff purely pythonic when I can. Pythons syntax is the most “fun” and “natural” for me so I find it fun. Like doin a sudoku puzzle

      • stevedidwhat_infosec@infosec.pub
        link
        fedilink
        arrow-up
        11
        ·
        10 months ago

        This is the best way I’ve ever heard this described lol. You get used to it so fast, it’s really simple. Just indent your code like you’re supposed to 🤷🏻‍♂️

        • frezik@midwest.social
          link
          fedilink
          arrow-up
          5
          ·
          10 months ago

          The problem is that Python programmers tend to think the job of readability is done just by indentation. This is wrong, and it shows in all sorts of readability issues. Many of which are in official docs.

          • Fushuan [he/him]@lemm.ee
            link
            fedilink
            English
            arrow-up
            5
            ·
            edit-2
            10 months ago

            Same could be said about people that don’t think that indentation is not important for readability. Both are important, but if you really care about it defining an auto formatter and customising it for whatever consensus the team has is the only way to operate anyway.

            • frezik@midwest.social
              link
              fedilink
              arrow-up
              5
              ·
              10 months ago

              Same could be said about people that don’t think that indentation is not important for readability.

              You should really avoid double negatives. What you actually said was "Same could be said about people that think that indentation is important for readability“, which makes no sense in the context of the rest of your post.

              And I’m not saying this just to be a dick about grammar. I mean, obviously I am, but not just that. If your English isn’t readable, then I don’t trust your Python, either.

              • Fushuan [he/him]@lemm.ee
                link
                fedilink
                English
                arrow-up
                2
                ·
                10 months ago

                My bad, I deleted part of the comment to rewrite it and forgot part of the original. And as you probably guessed I meant for it to be a single negative.

                Good thing this is a casual forum and not a work environment where I would reread my code with care haha. There’s a reason linters exist in code editors, it’s for people like me.

          • stevedidwhat_infosec@infosec.pub
            link
            fedilink
            arrow-up
            3
            ·
            edit-2
            10 months ago

            Yeah pythonistas just group bad code into “non-pythonic”

            It’s basically a credo if you aren’t familiar but Python is preeeetty explicit about formatting recommendations and whatnot so there’s really no excuse for poor Python practices/non-pythonic code

            • frezik@midwest.social
              link
              fedilink
              arrow-up
              1
              ·
              10 months ago

              Then what the hell is this shit?

              class argparse.ArgumentParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=argparse.HelpFormatter, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True, exit_on_error=True)
              

              This is a mess. None of this ascii vomit is useful or enlightening.

              I got it from the argparse docs, which is a core module. But really, this is just the way Python docs are generated. Every class doc has an ascii vomit like this at the top, and my eyes hurt every time I see it.

                • frezik@midwest.social
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  edit-2
                  10 months ago

                  Markdown seems to put it on one line, which has its own problems, but this is what it looks like in actual docs:

                  Argparse documentation

                  This is hardly even the worst offender; it gets worse as the number of internal class members goes up, since they all get listed out. This whole section should just be dropped in favor of simply listing the class name. Further down, there’s a bulleted list of the params, which is what you actually want.

                  In fact, there’s plenty more in that doc that could be fixed. For example:

                  parser.add_argument('integers', metavar='N', type=int, nargs='+',
                                      help='an integer for the accumulator')
                  

                  Too many parameters on each line. Do this instead:

                  parser.add_argument(
                      'integers',
                      metavar = 'N',
                      type = int,
                      nargs = '+',
                      help = 'an integer for the accumulator'
                  )
                  

                  This also puts more whitespace around the key/value pairs, which gives your eyes more resting point. In general, erring on the side of additional whitespace around non-alphanum characters tends to improve readability.

                  This style can come into conflict with coding rules about max function length. The solution to that is to be flexible about max function length. I would rather see 40 simple lines than 10 with everything jammed up together.

                  Edit: interestingly, my Lemmy instance seems to handle syntax highlighting on the second add_argument example better than the first. That might just be the implementation, though; my vim setup seems to handle highlighting both equivalently.

                  • CapeWearingAeroplane@sopuli.xyz
                    link
                    fedilink
                    arrow-up
                    1
                    ·
                    10 months ago

                    I have to be honest: I dont see the problem of including the entire signature at the top of the doc, and the listing the params below. If I know the class/function, a quick look at the signature is often all I need, so I find it convenient that it’s at the top of the doc. If it’s a class/function I’m not familiar with, I just scroll to the bullet points.

                    I agree on the bit about whitespace in signatures though. Luckily Python allows me to use as many lines as I want within a parentheses.

        • Da_Boom@iusearchlinux.fyi
          link
          fedilink
          English
          arrow-up
          5
          ·
          10 months ago

          At least untill someone sneaks a tab in your spaced code, and you don’t know how to make your code editor show the difference, or it doesn’t support showing the difference.

          • Fushuan [he/him]@lemm.ee
            link
            fedilink
            English
            arrow-up
            8
            arrow-down
            1
            ·
            edit-2
            10 months ago

            That sound like a you problem really, detecting this is quite simple because any editor worth their salt will literally lint you an issue saying that tabs and spaces are mixed and the thing literally won’t be interpreted. If your editor can’t show white spaces, chances are you are one google question away from discovering that it actually can do that easily.

            The more I code the less I mind the tool and the more I hate the ones using it wrong.

          • CapeWearingAeroplane@sopuli.xyz
            link
            fedilink
            arrow-up
            1
            ·
            edit-2
            10 months ago

            That will give you an extremely clear error when you run the code. Also, any IDE worth its salt should be able to fix that for you.

            Even the error message you get from C++ for missing a semicolon is harder to understand and fix than this.

        • mindbleach@sh.itjust.works
          link
          fedilink
          arrow-up
          3
          ·
          10 months ago

          Does “like you’re supposed to” mean with tabs, or with spaces?

          Because if someone else disagrees you are not going to have fun with their code.

          • Fushuan [he/him]@lemm.ee
            link
            fedilink
            English
            arrow-up
            2
            arrow-down
            3
            ·
            10 months ago

            Who TF codes with tabs? All the editors I know input spaces when pressing tab anyway.

            I would not have fun in any language if someone inputted actual tabs and their tab size was different from mine. Chances are my linter would have told me, regardless of language used!

            I have worked with OS projects in C and not even those were tab formatted.

            • mindbleach@sh.itjust.works
              link
              fedilink
              arrow-up
              5
              ·
              edit-2
              10 months ago

              Why the fuck does anyone use spaces when tabs mean everyone uses the same tab size as you? That’s what they’re for!

              • Fushuan [he/him]@lemm.ee
                link
                fedilink
                English
                arrow-up
                2
                ·
                10 months ago

                Yeah, okay. Tell that to every code editor’s defaults and every open source projects source code that I have read.

                Encountering tab indented files is like encountering ANSI encoded files or /r/n newline’d files. It’s not how it should be done. Sorry.

                Spaces are there to ensure that everyone sees the same, tabs have issues with internal indentation of function declaration and the sort. Yeah it indents like correctly, but then you do need spaces to indent vertically called functions correctly and it always ends up being a cluster fuck. Spaces are a standard for a reason.

                • mindbleach@sh.itjust.works
                  link
                  fedilink
                  arrow-up
                  1
                  ·
                  10 months ago

                  Stop lining up to function names like it’s fucking ASCII art!

                  It’s a hierarchy, not a grid! Did your function overflow one line? Add an extra tab. I don’t give a shit how long your function name is, you prima donna, your code should look clean even if some maniac is using 12-point Arial.

                  • Fushuan [he/him]@lemm.ee
                    link
                    fedilink
                    English
                    arrow-up
                    1
                    ·
                    10 months ago

                    You write as if you manually format stuff, auto formatters are a thing since ages ago that conform to stablished coding styles. Take up on stablished coding styles if you are against something as basic as lining up stuff to function names.

                    At this point I see that our viewpoints are way too different and that your viewpoint is quite disconnected from the coding world in general so, you do you, have a good day.

      • flashgnash@lemm.ee
        link
        fedilink
        arrow-up
        3
        ·
        10 months ago

        Python whitespace is child’s play compared to yaml, which I have the displeasure of having to interact with on the regular

        • bob_lemon@feddit.de
          link
          fedilink
          arrow-up
          2
          ·
          10 months ago

          Yaml is honestly just a terrible terrible format that is neither good for humans nor good for machines.

      • meteokr@community.adiquaints.moe
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        10 months ago

        I agree, whether or not it is good or bad, or readability concerns over nested braces. I fundamentally hate invisible delimiters. If it matters, make it visible. We have so many ascii characters, why not just borrow a few?

          • meteokr@community.adiquaints.moe
            link
            fedilink
            arrow-up
            1
            ·
            10 months ago

            Whitespace is not visible. It is the absence of something that is visible. Whitespace should be used for the comfort of the reader, not to determine scope. Are you proposing that a " " character is more visible than “{}”? The fact I must quote it to make what I am discussing even apparent speaks for itself. I’m not arguing that indentation is bad, far from it. In fact, the flexibility of using indentation purely for readability, makes code more readable.