[bind10-dev] Python style micro-nit

Shane Kerr shane at isc.org
Tue Jun 29 17:35:20 UTC 2010


All,

Something came up in a recent review that Jelte did on some of my code,
and I'd like to see if there are any preferences.

In Python you can say:

    if foo is not None:
        do_something()
    if bar not in baz:
        do_something_else()

You can also say:

    if not foo is None:
        do_something()
    if not bar in baz:
        do_something_else()

Jelte prefers the first style. I have no preference, although I did mix
them in my code and that's probably a bad thing (although with deep
thinking one could pick times when it was more important to put the
"not" first as it was closer to the meaning of the condition, and times
when it was important to put the "not" later).

Any other preferences? Is this important enough to even document?

--
Shane




More information about the bind10-dev mailing list