Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82034

Re: Tabs for indentation & Spaces for alignment in Python 3?

Date 2014-12-05 20:04 -0700
From Michael Torrie <torriem@gmail.com>
Subject Re: Tabs for indentation & Spaces for alignment in Python 3?
References <CAFaCOgzqxcvuKBrcSkK+DRm-5pHuh6QCXi1PKG4LHGqdBjLF_A@mail.gmail.com> <m5tpqg$iqi$1@ger.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.16650.1417835105.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 12/05/2014 07:31 PM, Ned Batchelder wrote:
> 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;

However, a conscientious programmer knows that tabs could be arbitrarily
sized, so he would never do that.  Instead he would do:

   >-------if (!list_empty(pending))
   >------->-------ret = list_first_entry(pending, struct async_entry,
   >------->-------.......................domain_list)->cookie;

Which under the heretical tab size of 4:
   >---if (!list_empty(pending))
   >--->---ret = list_first_entry(pending, struct async_entry,
   >--->---.......................domain_list)->cookie;

In fact a decent editor that is auto-indenting code would, at least in C
or C++ mode, do that automatically.

Maybe I misread, but I would think this is what the OP had in mind.
Of course maybe kernel programmers think differently.  Ahh well.



Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: Tabs for indentation & Spaces for alignment in Python 3? Michael Torrie <torriem@gmail.com> - 2014-12-05 20:04 -0700
  Re: Tabs for indentation & Spaces for alignment in Python 3? Marko Rauhamaa <marko@pacujo.net> - 2014-12-06 10:40 +0200
    Re: Tabs for indentation & Spaces for alignment in Python 3? Michael Torrie <torriem@gmail.com> - 2014-12-06 09:41 -0700
      Re: Tabs for indentation & Spaces for alignment in Python 3? Marko Rauhamaa <marko@pacujo.net> - 2014-12-06 18:57 +0200
        Re: Tabs for indentation & Spaces for alignment in Python 3? Michael Torrie <torriem@gmail.com> - 2014-12-06 10:26 -0700
          Re: Tabs for indentation & Spaces for alignment in Python 3? Marko Rauhamaa <marko@pacujo.net> - 2014-12-06 22:04 +0200
    Re: Tabs for indentation & Spaces for alignment in Python 3? Chris Angelico <rosuav@gmail.com> - 2014-12-07 03:46 +1100

csiph-web