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