Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20155
| References | <CACUCHEBhLhCCLL3OOudBKnuD2BZJvDkYzjmoi_nsVR+JPzEENA@mail.gmail.com> |
|---|---|
| Date | 2012-02-10 10:46 +0000 |
| Subject | Re: when to use import statements in the header, when to use import statements in the blocks where they are used? |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5650.1328870810.27778.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
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
csiph-web