Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100515 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2015-12-17 03:14 +1100 |
| Last post | 2015-12-17 03:14 +1100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: does the order in which the modules are placed in a file matters ? Chris Angelico <rosuav@gmail.com> - 2015-12-17 03:14 +1100
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-12-17 03:14 +1100 |
| Subject | Re: does the order in which the modules are placed in a file matters ? |
| Message-ID | <mailman.13.1450282457.30845.python-list@python.org> |
On Thu, Dec 17, 2015 at 3:09 AM, Ganesh Pal <ganesh1pal@gmail.com> wrote: > Iam on python 2.7 and linux .I need to know if we need to place the > modules in a particular or it doesn't matter at all > > order while writing the program > > For Example > > import os > import shlex > import subprocess > import time > import sys > import logging > import plaftform.cluster > from util import run The order of the import statements is the order the modules will get loaded up. As a general rule this won't matter; when it comes to standard library modules, you can generally assume that you can put them in any order without it making any difference. It's common to order them in some aesthetically-pleasing way (maybe alphabetical order, or maybe sort them by the length of the name - whatever you like). There is a broad convention that standard library modules get imported first, and modules that are part of the current project get imported afterwards. But even that doesn't usually matter very much. ChrisA
Back to top | Article view | comp.lang.python
csiph-web