Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34041
| Date | 2012-11-29 10:04 +1100 |
|---|---|
| Subject | Tabs/spaces for indentation (was Re: re.search when used within an if/else fails) |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.350.1354143899.29569.python-list@python.org> (permalink) |
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 comp.lang.python | Previous | Next | Find similar | Unroll thread
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
csiph-web