Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20155 > unrolled thread

Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

Started byArnaud Delobelle <arnodel@gmail.com>
First post2012-02-10 10:46 +0000
Last post2012-02-10 10:46 +0000
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.


Contents

  Re: when to use import statements in the header, when to use import statements in the blocks where they are used? Arnaud Delobelle <arnodel@gmail.com> - 2012-02-10 10:46 +0000

#20155 — Re: when to use import statements in the header, when to use import statements in the blocks where they are used?

FromArnaud Delobelle <arnodel@gmail.com>
Date2012-02-10 10:46 +0000
SubjectRe: when to use import statements in the header, when to use import statements in the blocks where they are used?
Message-ID<mailman.5650.1328870810.27778.python-list@python.org>
On 8 February 2012 01:48, Lei Cheng <pat.inside@gmail.com> wrote:
> Hi all,
>
>    In a py file, when to use import statements in the header, when to use
> import statements in the blocks where they are used?
>    What are the best practices?
>    Thanks!

Aside from other answers: in some rare cases, importing within a
function can avoid circularity problems (e.g. A imports B which tries
itself to import A)

-- 
Arnaud

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web