…from people who seem to refuse to install paredit or coloring plugins for either? ps lisp syntax ftw, it’s a feature!

  • sajran@lemmy.ml
    link
    fedilink
    English
    arrow-up
    20
    arrow-down
    3
    ·
    7 months ago

    So I’m going to say what I always say when people complain about semantic whitespace: Your code should be properly indented anyway. If it’s not, it’s a bad code.

    I’m not saying semantic whitespace is superior to brackets or parentheses. It’s clearly not. But it’s not terrible either.

    As someone who codes in Python pretty much everyday for years, I NEVER see indentation errors. I didn’t see them back when I started either. Code without indentation is impossible to read for me anyway so it makes zero difference whether the whitespace has semantic meaning or not. It will be there either way.

    • TechNom (nobody)@programming.dev
      link
      fedilink
      English
      arrow-up
      15
      arrow-down
      1
      ·
      edit-2
      7 months ago

      Python decided to use a single convention (semantic whitespace) instead of two separate ones for machine decodeable scoping and manual/visual scoping. That’s part of Python’s design principle. The program should behave exactly like what people expect it to (without strenuous reasoning exercises).

      But some people treat it as the original sin. Not surprised though. I’ve seen developers and engineers nurture weird irrational hatred towards all sorts of conventions. It’s like a phobia.

      Similar views about yaml. It may not be the most elegant - it had to be the superset of JSON, after all. But Yaml is a semi-configuration language while JSON is a pure serialization language. Try writing a kubernetes manifest or a compose file in pure JSON without whitespace alignment or comments (which pure JSON doesn’t support anyway). Let’s see how pleasant you find it.

    • Crisps@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      7 months ago

      This leads to weird bugs when you change indentation and miss a line or reorder lines. The logic changes. Not too bad when you’re on your own, as Python seems to be intended for. Add multiple developers and git merges and it is a recipe for disaster. With end tags at least you just end up with poorly formatted working code.

      • sajran@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        7 months ago

        It’s probably more prone to mistakes like that, true. But in practice I really never witnessed this actually being a problem. Especially with tests and review.

    • eluvatar@programming.dev
      link
      fedilink
      arrow-up
      5
      ·
      7 months ago

      The number of times I move code around and can just press a hotkey to fix indentation though. Not possible with Python.

      • sajran@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        7 months ago

        Yeah, that’s definitely a good point. But it’s a minor thing. Adjusting indentation takes 2 keystrokes in vim, I barely notice it.

      • sajran@lemmy.ml
        link
        fedilink
        English
        arrow-up
        4
        ·
        7 months ago

        Of course, but when indentation has a syntactic meaning the formatter often won’t be able to fix it.