Re: Style guide update?

Jim Fulton <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <CAPDm-FjCUbbEe7+3PhtV_r03kd1t4UEkNJy+Zzg7cy2G5rA0FQ@mail.gmail.com>
On Wed, Feb 13, 2013 at 1:53 AM, Marius Gedminas <[email protected]> wrote:
> On Tue, Feb 12, 2013 at 05:20:14PM -0500, Fred Drake wrote:
>> At one point, we had a style guide that recommended simple "import
>> <module>" import statements for Zope code:
>>
>>   http://wiki.zope.org/zope3/ZopePythonStyleGuide
>
> That page only mentions 'from whatever import *' which everyone will
> agree ought to be avoided.  It doesn't say anything about 'from whatever
> import somename' (except that you shouldn't import somename if you're
> not going to use it).
>
>> Today, I'm noticing a lot of commits with the change note "Normalize
>> imports" that change all imports to "from <module> import whatever",
>> like this one:
>>
>>   https://github.com/zopefoundation/zope.security/commit/115691fce9c80a340f271410eec2964c92fbace4
>>
>> Do we still have an agreed-upon style guide, or are we moving to a
>> last-touched-by approach?

I agree that Tres' changes don't seem to violate the style guide, such as it is.

I strongly prefer Fred's style of imports -- avoiding from imports except
for things that are used a whole lot.  I think it makes the code easier to
read because you don't have to wonder where names are coming from.

However, it's hard to object when someone's doing something that
needs to be done, porting to Python 3,  that I don't want to spend my
time on.

Jim

-- 
Jim Fulton
http://www.linkedin.com/in/jimfulton
Jerky is better than bacon! http://zo.pe/Kqm
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.