← Back to team overview

launchpad-dev team mailing list archive

Re: New coding standard for formatting imports

 

On Wed, 2010-08-18 at 10:26 -0400, Brad Crittenden wrote:
> 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,
>     ) 

And if it annoys you to see a couple screens full of imports, you can
use the vim plugin below to have them automatically folded.
 
  <http://people.canonical.com/~salgado/myfolding.vim>

As it only folds the global imports (which should be at the top of the
file), it's much faster than similar plugins I'd found.

-- 
Guilherme Salgado <https://launchpad.net/~salgado>

Attachment: signature.asc
Description: This is a digitally signed message part


References