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

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to