UVR wrote: > Is there an ON coding style guide for python? > I don't think we have an official answer to that yet.
Python has had its own style for a long time [1], and there are even style checkers for it [2]. Then again Sun has had a C style guideline for even longer that predisposes our engineers to tabs (with editors set to displaying them as 8 spaces wide) [3]. > My question (for now) is specifically about indentation width: > must it be 4 spaces or 8 spaces wide? The .py files under > usr/src/tools/onbld/Checks (for example) seem to use both. See > > [indent = 8 spaces] > http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/tools/onbld/Checks/Cddl.py > > [indent = 4 spaces] > http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/tools/onbld/Checks/Keywords.py > > Also, should indentation use tabs or only whitespace? The code > I looked at seems to use only the latter, but I thought I'd ask. > > Python does enforce using just one indentation style in the file. It would be nice for everything in the same directory to use just one style. But python doesn't enforce that. We are not using any tool to enforce python style in ON at this time. -dvd [1] http://www.python.org/dev/peps/pep-0008/ [2] http://svn.browsershots.org/trunk/devtools/pep8/ [3] http://opensolaris.org/os/community/documentation/getting_started_docs/cstyle.ms.pdf Section 6, "Indentation"
