mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
docs/code-style.rst: Update and clarify shebang rules.
This commit is contained in:
@@ -352,11 +352,13 @@ styles (separate lines for each selector)::
|
||||
Python
|
||||
------
|
||||
|
||||
- Scripts should start with ``#!/usr/bin/env python2.7`` and not
|
||||
``#!/usr/bin/env python2.7``. See commit ``437d4aee`` for an explanation of
|
||||
why. Don't put such a line on a Python file unless it's meaningful to
|
||||
run it as a script. (Some libraries can also be run as scripts, e.g.
|
||||
to run a test suite.)
|
||||
- Scripts should start with ``#!/usr/bin/env python`` and not
|
||||
``#/usr/bin/python`` (the right Python may not be installed at
|
||||
/usr/bin) or ``#/usr/bin/env/python2.7`` (bad for Python 3
|
||||
compatibility). Don't put a shebang line on a Python file unless
|
||||
it's meaningful to run it as a script. (Some libraries can also be
|
||||
run as scripts, e.g. to run a test suite.)
|
||||
|
||||
- The first import in a file should be
|
||||
``from __future__ import absolute_import``, per `PEP
|
||||
328 <http://docs.python.org/2/whatsnew/2.5.html#pep-328-absolute-and-relative-imports>`__
|
||||
|
||||
Reference in New Issue
Block a user