[Distutils] My (slightly goofy) coding standard

Greg Ward gward@python.net
Mon Sep 25 22:22:02 2000

Hi all --

I have just completed one pass over the Distutils source to enforce one
minor coding convention: whitespace next to the open parentheses when
calling a function (or other callable).  Anyone hacking on the Distutils
needs to know about this convention, which is slightly odd but quite
defensible (IMHO):

  * when *defining* a callable, use a space:
        def foo ():
        def foo (arg1, arg2, ...):
        class SubThing (Thing):

  * corollary: for long functions that need a "# end"-style line,
    it looks like this:
        def foo ():
            # > 40 lines of code (say)
        # foo ()

    because the "# foo ()" line is part of the definition

  * when *using* a callable, no space:
        foo(2, "hello")
            arg1, arg2, arg3, ...)

Rationale: this makes it trivial (grep-wise) to distinguish between
*definition* and *use*.  I *know* what Guido's coding standard says, but
the problem with "def foo()" is that you can't search for use only
without a negative lookbehind to exclude "def" lines... and my "grep"
doesn't have negative lookbehind.

Anyways, that's the Distutils convention as of tonight.  Please respect
it when hacking on the code!  (And please fix deviance if you submit
patches: I've only fixed up distutils/*.py, excluding *ccompiler.py
because of a pending patch.  distutils/command/*.py is still to go; I
can only do so much brain-dead search 'n replace work at once.)

Greg Ward                                      gward@python.net