Reports until 11:09, Thursday 12 April 2018
H1 CDS
david.barker@LIGO.ORG - posted 11:09, Thursday 12 April 2018 (41405)
mixing tabs and spaces for indentation not just a bad idea for python code

A word of caution that indenting code using a mixture of spaces and tabs will result in code which looks very different depending upon which editor is being used to view it. In the two attachments a snippet of the same C code is shown being viewed using the editors vi and gedit. The vi example shows consistent indentation, the gedit version shows erroneous indentation. This is because the code mixes tabs and spaces for indentation, and vi defaults to a tab size of 4 spaces, and gedit 8 spaces. This can be further compounded in that the code itself can redefine the tab size with the directive "-*- tab-width: 6;" which is honored by some editors (e.g. gedit) and not others.

Take home message: it is best to adopt Python's PEP8 standard of always using 4 spaces for indentation for all LIGO code to avoid this confusion.

Images attached to this report