Is this a valid use of 'import'?

Frank Millman frank at chagford.com
Tue Jul 22 11:28:24 EDT 2008


On Jul 22, 5:22 pm, Tim Golden <m... at timgolden.me.uk> wrote:
> Frank Millman wrote:
> > In this particular case, when it is executed, it does a whole lot
> > more. It reads in some parameters, establishes a socket connection,
> > starts a thread, and starts monitoring the socket using select.select.
> > It also exposes some functions that disguise the complexity of reading
> > from and writing to the socket.
>
> This is not, in general, a good idea, no matter how appealing!
> There is some subtle stuff going on within the chain of imports,
> and firing off a new thread is quite likely to confuse it in
> nasty ways later on. Less attractive though it may be, you're
> better off having a "startup" function or whatever and calling
> that:
>
> import Utils.client
> Utils.client.startup ()
>
> TJG

Makes sense.

Thanks, Tim.

Frank



More information about the Python-list mailing list