On Wed, Jul 21, 2010 at 12:47 PM, Scott Zawalski <[email protected]> wrote:
> > This is a patch that was submitted a long time ago that is just now being > mailed out. I have been asked by Frank Becker why we oppose following PEP8. > At the time I submitted this all of our files were following the style of > "one line imports." PEP8 speaks directly against this. > > Any thoughts on moving toward or at the very least allowing PEP8 style > imports? > > i.e. > > import sys > import os > In general I prefer this import style so yes, allowing it is a good thing. It makes diffs much easier to understand what is going on and it makes it easier to keep the list of imports somewhat sorted without lots of editing. I believe our code base today is a mix of both. > instead of what we suggest. > > import sys, os > > -Scott > > On Tue, Jul 20, 2010 at 18:03, Scott Zawalski <[email protected]> wrote: > >> Add import coding style specification >> >> Signed-off-by: Scott Zawalski <[email protected]> >> >> --- autotest/CODING_STYLE 2010-07-20 18:02:25.000000000 -0700 >> +++ autotest/CODING_STYLE 2010-07-20 18:02:25.000000000 -0700 >> @@ -37,6 +37,30 @@ >> of your variable_names please. I shall make a bedgrudging exception for >> class >> names I suppose, but I'll still whine about it a lot. >> >> +Importing modules >> + >> +The order of imports should be as follows: >> + >> +Standard python modules >> +Non-standard python modules >> +Autotest modules >> + >> +Within one of these three sections, all module imports using the from >> +keyword should appear after regular imports. >> +Modules should be lumped together on the same line. >> +Wildcard imports (from x import *) should be avoided if possible. >> +Classes should not be imported from modules, but modules may be imported >> + from packages, i.e.: >> +from common_lib import error >> +and not >> +from common_lib.error import AutoservError >> + >> +For example: >> +import os, pickle, random, re, select, shutil, signal, StringIO, >> subprocess >> +import sys, time, urllib, urlparse >> +import MySQLdb >> +from common_lib import error >> + >> >> Comments >> > > > _______________________________________________ > Autotest mailing list > [email protected] > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest > >
_______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
