[Zope3-dev] Re: Code cleanup day

Marius Gedminas mgedmin at b4net.lt
Wed Feb 25 12:35:28 EST 2004


On Wed, Feb 25, 2004 at 04:11:09PM +0100, Philipp von Weitershausen wrote:
> 5. Make the commonly long list of imports more scrutable.

Also trim imports that are not needed.  I ran a homebrew dependency checker
tool (hi, Martijn, Stephan ;-) on Zope 3 and it reported over 700 unused
imports.  Some of those are false positives, e.g. things that are imported into
__init__.py for API reasons, but other imports can (and should) be safely
removed.

> I haven't 
> found anything in the coding style, but I usually follow this order::
> 
>   1. Import modules from standard python library/global ackages
>   2. Import modules from the 'zope' package
>   3. Import modules from the 'zope.app' package
> 
> while "import XYZ" goes before "from XYZ import ABC".

PEP 8 says

"""
    - Imports are always put at the top of the file, just after any
      module comments and docstrings, and before module globals and
      constants. 

      1. standard library imports
      2. related major package imports (i.e. all email package imports next)
      3. application specific imports

      You should put a blank line between each group of imports.
"""

Marius Gedminas
-- 
If you are angry with someone, you should walk a mile in their shoes... then
you'll be a mile away from them, and you'll have their shoes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-dev/attachments/20040225/256583b9/attachment.bin


More information about the Zope3-dev mailing list