Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25766 > unrolled thread
| Started by | Bruce Sherwood <bruce.sherwood@gmail.com> |
|---|---|
| First post | 2012-07-21 14:36 -0600 |
| Last post | 2012-07-21 14:36 -0600 |
| 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: A thread import problem Bruce Sherwood <bruce.sherwood@gmail.com> - 2012-07-21 14:36 -0600
| From | Bruce Sherwood <bruce.sherwood@gmail.com> |
|---|---|
| Date | 2012-07-21 14:36 -0600 |
| Subject | Re: A thread import problem |
| Message-ID | <mailman.2397.1342903004.4697.python-list@python.org> |
Thanks much for this clear statement. I hadn't managed to find any documentation on this specific issue. Bruce Sherwood On Sat, Jul 21, 2012 at 10:26 AM, Dave Angel <d@davea.name> wrote: > Two of the things you mustn't do during an import: > > 1) start or end any threads > 2) import something that's already in the chain of pending imports. > (otherwise known as recursive imports, or import loop). And there's a > special whammy reserved for those who import the script as though it > were a module. > > Like any rule, there are possible exceptions. But you're much better > off factoring your code better. > > I haven't managed to understand your software description, so i'm not > making a specific suggestion. But I know others have pointed out that > you should do as little as possible in top-level code of an imported > module. Make the work happen in a function, and call that function from > the original script, not from inside some import. An imported module's > top-level code should do nothing more complex than initialize module > constants. > > > -- > > DaveA > >
Back to top | Article view | comp.lang.python
csiph-web