FAQ
The only restriction is that if you want to reference some imported thing at
the module level, then the import has to precede the use:

import x
class cls(x.cls1):
pass

Other than that I don't know of any reasons (other than readability, which
can be interpreted to advantage either way).

-- Rob --

"Hallvard B Furuseth" (nospam).no> wrote in
message news:HBF.20030828usgy at bombur.uio.no...
Is there any reason not to structure my program like this?

def ...
def ...
var = ...
var = ...
import ...
import ...
main_function()

E.g. does it compile to slower code, or does it confuse PyChecker or
something, if I put the imports after the functions that use them?

--
Hallvard

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 6 of 7 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedAug 28, '03 at 6:25p
activeSep 1, '03 at 6:26p
posts7
users5
websitepython.org

People

Translate

site design / logo © 2022 Grokbase