Re: double import protection - how to ?

2008-12-01 Thread Helmut Jarausch
Peter Otten wrote: Helmut Jarausch wrote: Peter Otten wrote: Helmut Jarausch wrote: Then it's a problem with a problem with a webserver written in Python (Karrigell-3.0) and probably related to multi-threading (the statements in my module get definitely executed more than once). Maybe you

Re: double import protection - how to ?

2008-11-29 Thread Peter Otten
Helmut Jarausch wrote: > Peter Otten wrote: >> Helmut Jarausch wrote: >> >>> I have a module which gets imported at several different places >>> not all of which are under my control. >>> >>> How can I achieve that all/some statements within that module >>> get executed only at the very first im

Re: double import protection - how to ?

2008-11-29 Thread Fuzzyman
On Nov 29, 3:40 pm, Helmut Jarausch <[EMAIL PROTECTED]> wrote: > Peter Otten wrote: > > Helmut Jarausch wrote: > > >> I have a module which gets imported at several different places > >> not all of which are under my control. > > >> How can I achieve that  all/some statements within that module > >

Re: double import protection - how to ?

2008-11-29 Thread Helmut Jarausch
Peter Otten wrote: Helmut Jarausch wrote: I have a module which gets imported at several different places not all of which are under my control. How can I achieve that all/some statements within that module get executed only at the very first import? What you describe is Python's default be

Re: double import protection - how to ?

2008-11-29 Thread Peter Otten
Helmut Jarausch wrote: > I have a module which gets imported at several different places > not all of which are under my control. > > How can I achieve that  all/some statements within that module > get executed only at the very first import? What you describe is Python's default behaviour. A mo

Re: double import protection - how to ?

2008-11-29 Thread Steven D'Aprano
On Sat, 29 Nov 2008 13:43:45 +0100, Helmut Jarausch wrote: > How can I achieve that all/some statements within that module get > executed only at the very first import? (the statement which must be > executed only once, initializes another OS-thread (java in my case)) Python already enforces tha

double import protection - how to ?

2008-11-29 Thread Helmut Jarausch
Hi, sorry if this is a FAQ (I couldn't find an answer) I have a module which gets imported at several different places not all of which are under my control. How can I achieve that all/some statements within that module get executed only at the very first import? (the statement which must be e