launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #04349
New coding standard for formatting imports
A few weeks ago Robert Collins raised the issue of revising our coding standards regarding imports. For a while we've had the standard that lists should be formatted one-item-per line such as;
animals = [
cows,
ducks,
pigs,
]
(Note the required trailing comma on the last item.)
We had an exception for imports and allowed them to have multiple on a line.
After discussion and voting we decided to have imports be one-per-line, too.
from lp.registry.animals import (
cows,
ducks,
pigs,
)
If you only import one symbol, keeping it on the same line is preferred:
from lp.registry.cars import citroen
Henning Eggers will be writing a tool to reformat imports and will do it all at once. Until then reviewers will not be enforcing the policy.
--Brad
Follow ups