Skip to content

Commit

Permalink
Clarify import standards
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Hammond authored and tobes committed Nov 20, 2012
1 parent c79a4e5 commit de978e2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions doc/coding-standards.rst
Expand Up @@ -146,11 +146,15 @@ Layout and formatting
Imports
-------

- Import whole modules, rather than using ``from foo import bar``. It's ok
to alias imported modules to make things more concise, ie this *is*
acceptable: ::
- Don't use ``from module import *`` or ``from module import name``. Instead
just ``import module`` and then access names with ``module.name``.
See `Idioms and Anti-Idioms in Python`_.

import foo.bar.baz as f
You can make long module names more concise by aliasing them::
import foo.bar.baz as baz

and then access it with ``baz`` in your code.

- Make all imports at the start of the file, after the module docstring.
Imports should be grouped in the following order:
Expand All @@ -159,6 +163,8 @@ Imports
2. Third-party imports
3. CKAN imports

.. _Idioms and Anti-Idioms in Python: http://docs.python.org/2/howto/doanddont.html

Logging
-------

Expand Down

0 comments on commit de978e2

Please sign in to comment.