Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65562
| References | <f63f079f-da05-4f09-ad01-4b764ef16d7f@googlegroups.com> <ld0rb2$5od$1@ger.gmane.org> <CACwCsY780xSMED=Gn-QSvRzbb_Y0=QcJuqfkUS1OVomvE6YRJA@mail.gmail.com> <52F3FF51.3050502@stoneleaf.us> <CACwCsY4h4K9knZRkhV=DweCAHiLx4UpmqO2BHT_NFdCqu5MzZg@mail.gmail.com> |
|---|---|
| Date | 2014-02-07 09:30 +1100 |
| Subject | Re: how to reduce bugs due to incorrect indentation |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.6463.1391725827.18130.python-list@python.org> (permalink) |
On Fri, Feb 7, 2014 at 9:09 AM, Larry Martell <larry.martell@gmail.com> wrote: > The Tab key is not evil, it's the tab character (Ctrl-I). I have been > bitten by this many time when I had to work on a program written by > another. They had their tab stops set at 5 or 6, mine is set at 4, or > they did not have expandtab set, but I did. So you get either a script > that looks misaligned, but works, or one that does not look misaligned > but doesn't work. When I have to pick up someone else's script the > first thing I do is replace the tabs with spaces. All you've proven is that *mixing* spaces and tabs is evil. It's like arguing that oil is evil because, when you mix it with water, weird stuff happens. But that doesn't mean I want to fry my bacon in water. Mmm, bacon. Sorry. I'm back now. Ahem. Arguably, a better fix is to replace spaces with tabs, because they're more obvious. But mainly, just be consistent. Whatever one file uses, it uses exclusively. It'd be pretty easy to create a git commit hook that checks files for leading indentation and rejects the commit if it's mismatched; I would guess the same is true in Mercurial. But none of this would solve the OP's original issue. Whether it's a tab or spaces, unexpectedly indenting a line of code is a problem. It's no different from accidentally hitting Ctrl-T in SciTE and reordering two lines, when one line depends on the other. It's a bug. So you look at your commits before you make them (to give yourself a chance to catch it quickly), and you make sure you can always look back over your commits (in case you didn't catch it quickly). Much better than blaming the characters involved. Poor innocent U+0009. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how to reduce bugs due to incorrect indentation msustik@gmail.com - 2014-02-05 19:02 -0800
Re: how to reduce bugs due to incorrect indentation Dan Sommers <dan@tombstonezero.net> - 2014-02-06 03:08 +0000
Re: how to reduce bugs due to incorrect indentation Chris Angelico <rosuav@gmail.com> - 2014-02-06 15:47 +1100
Re: how to reduce bugs due to incorrect indentation Asaf Las <roegltd@gmail.com> - 2014-02-05 21:23 -0800
Re: how to reduce bugs due to incorrect indentation Terry Reedy <tjreedy@udel.edu> - 2014-02-06 03:09 -0500
Re: how to reduce bugs due to incorrect indentation Grant Edwards <invalid@invalid.invalid> - 2014-02-06 14:49 +0000
Re: how to reduce bugs due to incorrect indentation msustik@gmail.com - 2014-02-06 10:51 -0800
Re: how to reduce bugs due to incorrect indentation Roel Schroeven <roel@roelschroeven.net> - 2014-02-06 21:29 +0100
Re: how to reduce bugs due to incorrect indentation msustik@gmail.com - 2014-02-06 17:20 -0800
Re: how to reduce bugs due to incorrect indentation Chris Angelico <rosuav@gmail.com> - 2014-02-07 12:57 +1100
Re: how to reduce bugs due to incorrect indentation Roel Schroeven <roel@roelschroeven.net> - 2014-02-07 23:08 +0100
Re: how to reduce bugs due to incorrect indentation Jurko Gospodnetić <jurko.gospodnetic@pke.hr> - 2014-02-08 12:11 +0100
Re: how to reduce bugs due to incorrect indentation Larry Martell <larry.martell@gmail.com> - 2014-02-06 15:36 -0500
Re: how to reduce bugs due to incorrect indentation Ethan Furman <ethan@stoneleaf.us> - 2014-02-06 13:32 -0800
Re: how to reduce bugs due to incorrect indentation Larry Martell <larry.martell@gmail.com> - 2014-02-06 17:09 -0500
Re: how to reduce bugs due to incorrect indentation Chris Angelico <rosuav@gmail.com> - 2014-02-07 09:30 +1100
Re: how to reduce bugs due to incorrect indentation Asaf Las <roegltd@gmail.com> - 2014-02-06 15:01 -0800
Re: how to reduce bugs due to incorrect indentation Chris Angelico <rosuav@gmail.com> - 2014-02-07 11:08 +1100
Re: how to reduce bugs due to incorrect indentation Roel Schroeven <roel@roelschroeven.net> - 2014-02-07 23:06 +0100
csiph-web