← Back to team overview

openstack team mailing list archive

Re: Being pedantic about pedanticism: HACKING styleguide

 

On Thu, Mar 22, 2012 at 4:26 PM, Maru Newby <mnewby@xxxxxxxxxxxx> wrote:

> Hi Jay,
>
> On 2012-03-22, at 2:13 PM, Jay Pipes wrote:
>
>
> Object Imports
> ==============
>
> In addition, the following DOES NOT appear in Glance's section on imports:
>
> - Do not import objects, only modules
>
> Nowhere in PEP8 does it mention anything about not importing objects. In
> fact, PEP8
>
> says this:
>
>
The rule is there because it makes it obvious where you are using objects
from (and they aren't in the current namespace), prevents that "where is
this defined -scan around the file- oh, it is being imported from this
other thing, let's go look there" pattern, instead you see very obviously
that it isn't defined in the file and usually has a unique enough name
already that you know exactly where to look.

It is something pulled from the google style guide.

>
> I'm pretty sure the reason for this rule has nothing to do with PEP8, and
> is instead intended to avoid circular imports.  I don't see the utility in
> applying the rule to 3rd party modules, since circular imports wouldn't be
> an issue, but I do consider it a best practice for project code.
>
> Cheers,
>
>
> Maru
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References