Maintaining Maximum Line Length When Using Tabs Instead of Spaces?

Ben Finney ben+python at benfinney.id.au
Sun Dec 7 23:47:20 EST 2014


Chris Angelico <rosuav at gmail.com> writes:

> On Mon, Dec 8, 2014 at 1:15 PM, Aahan Krish <krish at aahan.me> wrote:
> > My question is to them (because I want to use tabs too) is: how do you
> > maintain a line-length of 79 characters?
> >
> > E.g. scenario: The tab setting in your editor could be 2 or 4, and in
> > other developer's browser it could be 8. The code will be longer than
> > 79 chars in the latter's editor.
>
> Easy: You stop fretting about 79 characters. :)

The question is a good one, especially when one considers the use of an
automated test to detect lines which violate an agreed style guide.

> If your policy is "lines are no more than 80-100 characters long",

Such a policy still needs to know how many columns a U+0009 TAB
character is to be counted, if an automated test is to be useful.

You may not find value in such an automated “does this code meet the
agreed style guide?” test, but many do. Perhaps the OP is one.

-- 
 \         “How wonderful that we have met with a paradox. Now we have |
  `\                        some hope of making progress.” —Niels Bohr |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list