Maintaining Maximum Line Length When Using Tabs Instead of Spaces?

Jean-Michel Pichavant jeanmichel at sequans.com
Mon Dec 8 08:07:36 EST 2014


----- Original Message -----
> From: "Aahan Krish" <krish at aahan.me>
> To: python-list at python.org
> Sent: Monday, 8 December, 2014 3:15:43 AM
> Subject: Maintaining Maximum Line Length When Using Tabs Instead of Spaces?
> 
> My understanding from talking to different people is that many do use
> tabs (instead of spaces) for indentation in their code.
> 
> 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.
> 
> I want to know if it's at all possible or if you use some simple and
> realistic (practical) hacks.
> 
> *PS: Please avoid, "That's why you should use spaces," type of
> comments. I would like to avoid flame wars.*
> 
> TY,
> Aahan

You simply need to define the standard width for you tab display. 4 is very common.

Those in your team who want to use a different display (3 flowers for instance) can, but they'll have to deal with the 79 limit by themselves which can be tricky.
Note that the 79 limit is a legacy value from the time where code was developed in 80 characters terminals with names not exceeding 8 characters (by convention).

Given the number of monitors you have and their width, you may extend this limit. For instance, I can easily make a 3 files merge with 160 chars per line without problem.
Considering the current state of most developer hardware, a limit around 100 char per line is most of the time a better choice.

Remember that breaking a line of 81 characters often leads to readability issue for no (modern) reason.


JM






-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


More information about the Python-list mailing list