Tabs vs spaces

Discussion in 'Webmastering & Programming' started by Dunamis, Mar 8, 2019.

  1. Dunamis

    Dunamis [H]Lurker Supreme[/H]

    Messages:
    2,047
    Joined:
    Jun 30, 2004


    It's tabs of course :cool:
     
    Parja, ChristianVirtual and mwarps like this.
  2. Brian_B

    Brian_B 2[H]4U

    Messages:
    2,261
    Joined:
    Mar 23, 2012
    Who the hell in their right mind uses spaces?
     
    Parja likes this.
  3. cyclone3d

    cyclone3d [H]ardForum Junkie

    Messages:
    12,787
    Joined:
    Aug 16, 2004
    It is worse when you are working on somebody else's code and they used tabs and spaces.
     
    mwarps and wolfofone like this.
  4. tedych

    tedych Limp Gawd

    Messages:
    311
    Joined:
    Jan 18, 2013
    Not exactly on-topic, but I HATE (mildly said) "indentation" languages where indentation determines blocks! Like in Python.
    One space somewhere and you could be screwed for hours chasing a Stupid thing. And there spaces/tabs mixture can be disastrous.
    In other (normal) languages a space here or there used sparingly and on purpose can be helpful but for main indentation I see almost no use for them. Of course tabs are the way to go for multiple reasons.
     
  5. mwarps

    mwarps [H]ardness Supreme

    Messages:
    7,063
    Joined:
    Oct 6, 2002
    Umm, Python doesn't let you be inconsistent. It'll throw a TabError, and it'll show you where it is.
    Any IDE will do the same.

    You can also define how tabs/spaces are handled in most editors and nearly all IDEs.

    Doesn't seem like you're up to date on modern programming in Python.
     
  6. modi123

    modi123 [H]ardness Supreme

    Messages:
    4,969
    Joined:
    Sep 6, 2006
  7. tedych

    tedych Limp Gawd

    Messages:
    311
    Joined:
    Jan 18, 2013
    I got to know about Python just recently. I don't have extensive experience. I even tried PyCharm as IDE. This doesn't have anything to do with my opinion and facts. You could happen to need to edit something in a plain text editor or something. Not even mentioning if you happen to need to copy/paste code from different sources (web, skype, other IM) where blanks could be stripped etc. etc... Ugly outcome.
    Apart from mixture of spaces and tabs, I LIKE being able to be inconsistent if I want to in specific cases. The point is, this indented programming is only "invented" for people who fidn it "easy" to program blocks using visual indenting. This makes it much more dangerous than "normal" languages where you use normal tokens to define blocks.
     
  8. mwarps

    mwarps [H]ardness Supreme

    Messages:
    7,063
    Joined:
    Oct 6, 2002
    I mean sure, if you want to be an awful hack, go for it. For those of us who use the language and know how it works, your response is amusing. Never mind the fact you won't find a job (or keep one long) with that attitude and poor programming technique. I know Java and C++ programmers who are more fanatical over indentation than Python programmers. Good luck in your career. :cool:
     
  9. tedych

    tedych Limp Gawd

    Messages:
    311
    Joined:
    Jan 18, 2013
    Don't worry about my career :) . "My" languages are all braces-based and fortunately the ONLY ubiquitous "indentation" lang that I may one day need for anything is Python. You may find whatever yo like amusing and all but fanaticism is not something that has to do with sane arguments etc. and is not appropriate for our discussion, I'm sorry. It's not a good testimonial in any activity.
    One argument that I'll reiterate is one stray space somewhere would not break any braces-based language. Which ever is important for me is code stability, reliability and not a fanatic love for indentations because they forced a style. I can give examples of fanatical people who are more fanatical than your Java folks and who kill people, is that relevant?! Me too, I keep indentations everywhere but that had nothing to do with my hate about forcing indentations to define blocks because it has more drawbacks than it solves. A good programmer doesn't need to be restricted this way, and the bad programmer would write buggy code regardless. Thus speaking, good luck in Your career.
    Python might be ubiquitous today and I use it for small things, that doesn't mean I cannot hate aspects of it.
     
    Last edited: Mar 14, 2019
  10. KarsusTG

    KarsusTG 2[H]4U

    Messages:
    2,873
    Joined:
    Aug 27, 2010
    I hate this when you get a bum makefile as well.
     
  11. ChristianVirtual

    ChristianVirtual [H]ard DCOTM Mar 2016,Aug 2017

    Messages:
    2,457
    Joined:
    Feb 23, 2013
    tab, 2 or 3 space-wide; mainly 3 ; hate 8 ... but its just me ...
    oh, and I could never marry a wife who put the { in the same line ... never ...
    {
    }
     
  12. cyclone3d

    cyclone3d [H]ardForum Junkie

    Messages:
    12,787
    Joined:
    Aug 16, 2004
    Some languages don't like the { being on the next line.
     
  13. modi123

    modi123 [H]ardness Supreme

    Messages:
    4,969
    Joined:
    Sep 6, 2006
    Which languages?! Let me know so I can avoid them. :)
     
  14. beyonddc

    beyonddc Limp Gawd

    Messages:
    401
    Joined:
    Sep 25, 2002
    I think this post deserves a poll. My opinion toward spaces versus tab is a personal preference. However if it is a coding standard mandated whether it is spaces or tab by the company then I am fine with that as well.

    I personally prefer spaces over tab but that is just me.

    Regarding with Python, for people who need to read spaghetti (messy) code from a day-to-day basis whether you are fixing a bug or inherited a big piece of legacy code, the way how Python enforces indention is just brilliant. It does make the code more readable (at least that's how I feel about it).

    That's just my two cents.
     
  15. notarat

    notarat [H]ard|Gawd

    Messages:
    1,656
    Joined:
    Mar 28, 2010
    modi123 likes this.
  16. tedych

    tedych Limp Gawd

    Messages:
    311
    Joined:
    Jan 18, 2013
    beyonddc, no, Python plain fails on the most important aspect - the argument it forces indentation is its biggest drawback. The fact you stand behind "spaces" is "brilliant". It's not that about personal preference - it's about arguments.
    Most important arguments are towards tabs. And what's your arguments in favor of spaces?
    I have the freedom to write spaghetti code IF I like, and I like the small "moments" where I have this freedom to indent some code some more or to wrap a line with another indent. It's not my style of coding but sometimes it's easier to do such small things. And no, those small things don't impede comprehension of code - only a totally bad programmer would say that. That was about Python's (and other) forced indentation style.
     
  17. goodcooper

    goodcooper [H]ardForum Junkie

    Messages:
    9,816
    Joined:
    Nov 4, 2005
    once i found out i could have my editor map my tab key to insert 2 spaces, i didn't care about tabs vs spaces...