• Natanox@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    9
    ·
    5 days ago

    Meaningful Indentation > Unnecessary visual clutter

    I will die on this hill. Python is wonderfully readable as it saves on unnecessary characters because indentations as well as line breaks are (usually) part of the syntax. Something like C++ with all its :;{}<> is just painful to read, not to mention annoying to write on many non-US keyboard layouts such as german without modifications.

    • iusemybrain@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 days ago

      I think having both the indentation and the braces surrounding code is much better than just indentation or braces, since it removes any ambiguity of what code goes to what if, for, or while loop/condition. we already have to memorize precedence to define ambiguous expressions. Why have another set of rules that could otherwise be prevented with braces and indentation?

    • CarrotsHaveEars@lemmy.ml
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      4 days ago

      The indentation is the visual clutter to me.

      Linebreaks are meant for casual readability, not end of statement, that’s how we write long statements on multiple lines. Therefore, we need a symbol for end-of-statement.

    • eldavi@lemmy.ml
      link
      fedilink
      English
      arrow-up
      2
      arrow-down
      3
      ·
      5 days ago

      said like someone who’s never had to parse through 10k+ lines of python source without an IDE. lol

  • roz@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    7
    ·
    5 days ago

    What’s worse, that Python doesn’t need semicolons, or that if used, they are ignored? 🤔

    • usernamesAreTricky@lemmy.ml
      link
      fedilink
      arrow-up
      4
      ·
      edit-2
      5 days ago
      >>> print("proof by counterexample in a python REPL")
      proof by counterexample in a python REPL
      >>> x = 2; print(x)
      2
      >>> print("this is not ignored"); print("it's just mostly useless"); print("but you can use as many as you want")
      this is not ignored
      it's just mostly useless
      but you can use as many as you want
      
  • vatlark@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    5 days ago

    She wants to be chosen. In python semicolons are optional in most cases. You choose to add them… mostly because you have been writing a lot of c lately