Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82032 > unrolled thread
| Started by | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| First post | 2014-12-05 21:31 -0500 |
| Last post | 2014-12-05 21:31 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Tabs for indentation & Spaces for alignment in Python 3? Ned Batchelder <ned@nedbatchelder.com> - 2014-12-05 21:31 -0500
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Date | 2014-12-05 21:31 -0500 |
| Subject | Re: Tabs for indentation & Spaces for alignment in Python 3? |
| Message-ID | <mailman.16648.1417833118.18130.python-list@python.org> |
On 12/5/14 8:50 PM, Aahan Krish wrote:
> Hello Ned,
>
> I thought that the use of tabs and spaces in the manner I suggested is
> pretty common. Linux Kernel follows the same technique, for example:
> https://github.com/torvalds/linux/blob/master/kernel/async.c#L100
>
This is a perfect example! The code (with tabs as >--- and leading
spaces as .) is:
>-------if (!list_empty(pending))
>------->-------ret = list_first_entry(pending, struct async_entry,
>------->------->------->-------.......domain_list)->cookie;
Now, display it in your editor with tabs set to four spaces:
>---if (!list_empty(pending))
>--->---ret = list_first_entry(pending, struct async_entry,
>--->--->--->---.......domain_list)->cookie;
"domain_list" and "pending" no longer line up, even though the author
worked so hard to make the code look nice.
In fact, the Linux kernel specifically says that tabs must be eight
spaces (https://www.kernel.org/doc/Documentation/CodingStyle):
Tabs are 8 characters, and thus indentations are also 8
characters. There are heretic movements that try to make
indentations 4 (or even 2!) characters deep, and that is akin
to trying to define the value of PI to be 3.
So you've started by trying to use tabs so that people can choose the
indentation width they like, and ended up with a strict rule that you
cannot change the size of tabs.
--
Ned Batchelder, http://nedbatchelder.com
Back to top | Article view | comp.lang.python
csiph-web