Paul McNett a écrit : > Björn Lindström wrote: > >> Paul Rubin <http://[EMAIL PROTECTED]> writes: >> >> >>> [EMAIL PROTECTED] (Björn Lindström) writes: >>> >>>> Actually using tabs for eight spaces and then filling out with >>>> spaces to >>>> the correct indentation is the convention for Emacs Lisp. Of course, >>>> since everyone coding Emacs Lisp does it with the same editor, it's no >>>> problem. >>> >>> >>> The variable `indent-tabs-mode' controls this. I like no tabs. >> >> >> >> Same here. It's still the convention for Emacs code, regrettably. > > > I don't use Emacs, I do indent with tabs, and I do fill in the extra > spaces of continuation lines with spaces. Therefore, I break all the > commandments and do everything wrong. ;) > > FWIW, I've long struggled with my opinion on tabs versus spaces. When I > started programming in 1995, tabs seemed the logical choice because I > was using different editors all the time and I could tell each editor > how many spaces to give each tab. But then as I started reading more > people's code I started seeing patterns in source code that I couldn't > emulate using pure tabs. This comes down to horizontal "lining up" > continuation lines with prior lines. Examples: > > select customer.cfirst, > customer.clast > from customer > where customer.cstate in ("CA", "OR") > order by customer.clast > > win = dabo.ui.dDialog(self, NameBase="frmRulesDialog", > Caption="Minesweeper Rules", > SaveRestorePosition=True, > Centered=True, Modal=False) > > Everyone that was writing "beautiful code" like this was using spaces > only. So I switched. But it was a real PITA to not be able to use any > old editor, only ones that could set how many hard spaces to make for > each hard tab. And, I had to remember to make that setting because I > prefer 2 spaces per tab. > > So now I'm back to tabs for indentation and spaces for lining up > continuation lines. Example: > > win = dabo.ui.dDialog(self, NameBase="frmRulesDialog", > Caption="Minesweeper Rules", > SaveRestorePosition=True, > Centered=True, Modal=False) > > (if that didn't come over email correctly, that is one tab for > indentation on all three lines, followed by several spaces on lines 2 > and 3 for getting the arguments lined up with the previous line.) > > I've been reluctant to admit to doing this since it violates the NEVER > MIX TABS AND SPACES commandment, but there you go. I found a way to > reconcile the best of both worlds, because let's face it, tabs do make > slightly more sense.
This is the only sane way to mix tabs with spaces anyway. Keep tabs as an indentation counter and use spaces to fill up the remaining space for the looks of the code. -- http://mail.python.org/mailman/listinfo/python-list