halubilo.social
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Sjmarf to Programmer [email protected] • 2 years ago

Brace Style

sh.itjust.works

message-square
153
fedilink
1.32K

Brace Style

sh.itjust.works

Sjmarf to Programmer [email protected] • 2 years ago
message-square
153
fedilink
  • @[email protected]
    link
    fedilink
    25•2 years ago

    YAML makes you appreciate Python’s 4 spaces indentation.

    • Victor
      link
      fedilink
      13•2 years ago

      I thought python allowed whatever indentation you wanted as long as it’s consistent?

      • @[email protected]
        link
        fedilink
        20•2 years ago

        pep8 calls for 4 space but it is a guidance not a rule.

        Google internal style guide recommend(ed?) 2 spaces to accomodate the line length limit.

      • @[email protected]
        link
        fedilink
        10•2 years ago

        It does, but most style guides and autoformatters will use 4

        • ℍ𝕂-𝟞𝟝
          link
          fedilink
          English
          11•2 years ago

          Python is one of the few languages with an official style guide, I think that guide says 4 spaces.

          • @[email protected]
            link
            fedilink
            5•2 years ago

            Tabs!

            • @[email protected]
              link
              fedilink
              English
              11•2 years ago

              I’ve set tabs to four spaces in vim because who the fuck defaults tab to eight spaces. That shit looks alien and pushes text off the screen fast.

              • @[email protected]
                link
                fedilink
                English
                8•
                edit-2
                2 years ago

                deleted by creator

                • @[email protected]
                  link
                  fedilink
                  English
                  1•2 years ago

                  I don’t develop kernel modules, I use python. That’s pretty interesting though.

              • @[email protected]
                link
                fedilink
                English
                4•2 years ago

                I set my clang-format to tabs only (actual tabs ASCII 0x9, no alignment and there is a continuation tab instead), then anyone can set their editor to whatever tab length they feel like and look at their code however they want.

                But no spaces on the left of my code. This is for C, C++ and JSON.

            • lad
              link
              fedilink
              English
              5•2 years ago

              4 tabs is a bit overboard, don’t you think?

            • baltakatei
              link
              fedilink
              1•2 years ago

              deleted by creator

    • @[email protected]
      link
      fedilink
      1•2 years ago

      4 spaces? Hard core Python programmers must have a callus on their thumbs.

      • @[email protected]
        link
        fedilink
        English
        6•2 years ago

        Just assign tab to 4 spaces.

Programmer [email protected]

[email protected]

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: [email protected]

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
    • If the mod doesn’t find it funny, you’re banned. Ha-ha!.. For real: do not use the community for “statements”. There are other places for such content. Keep it chill and funny.
  • 354 users / day
  • 3.2K users / week
  • 7.09K users / month
  • 17.2K users / 6 months
  • 33.3K subscribers
  • 2.55K Posts
  • 96.1K Comments
  • Modlog
  • mods:
  • Feyter
  • adr1an
  • @[email protected]
  • Pierre-Yves Lapersonne
  • BE: 0.19.3
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org