Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34041 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2012-11-29 10:04 +1100 |
| Last post | 2012-11-29 10:04 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
Tabs/spaces for indentation (was Re: re.search when used within an if/else fails) Chris Angelico <rosuav@gmail.com> - 2012-11-29 10:04 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2012-11-29 10:04 +1100 |
| Subject | Tabs/spaces for indentation (was Re: re.search when used within an if/else fails) |
| Message-ID | <mailman.350.1354143899.29569.python-list@python.org> |
On Thu, Nov 29, 2012 at 8:39 AM, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > Perhaps it would be nice if Python honoured a directive setting indent > style to spaces or indents, as it honours source code encoding lines: > > # -*- indent: <mode> -*- > > Where <mode> could be one of: > > space[s] Only accept spaces in indentation > tab[s] Only accept tabs in indentation > mixed Accept "mixed" tabs and spaces, but only if consistent > > with mixed the default for backward compatibility. I don't know that it needs to be a declaration like that; character encodings are critical to parsing the file, but newline-followed-by-tab and newline-followed-by-space are unambiguous. But it would be of value to have something like that, as editors could then be configured to respect it - set the editor to turn tab-key into N spaces but only if "indent tab" is not set, for instance. The question is, is it worth it? The main value would be when you're editing someone else's code. ChrisA
Back to top | Article view | comp.lang.python
csiph-web