Re: Explicit or general importing of namespaces?

2005-03-04 Thread Harlin Seritt
I think the bottom line on this is using your own sense of risk/reward with each given module imported. Some modules (Tkinter comes to mind) it makes sense to pollute while others it doesn't. Harlin Peter Hansen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Peter Mayne wrote:

Re: Explicit or general importing of namespaces?

2005-03-03 Thread Peter Mayne
Peter Hansen wrote: In general, unless the names being imported are *guaranteed* never to be rebound, it is a very bad idea to use import *, and it's still a bad idea in almost all cases anyway, for reasons already given by others. Since I've been playing with PyQt lately... Is qt not one of the

Re: Explicit or general importing of namespaces?

2005-03-03 Thread Peter Hansen
Peter Mayne wrote: Peter Hansen wrote: and it's still a bad idea in almost all cases anyway Since I've been playing with PyQt lately... Is qt not one of the almost all cases? From the limited number of examples I've seen, it seems to be common to do from qt import * This sort of thing seems

Explicit or general importing of namespaces?

2005-02-28 Thread Harlin Seritt
Is there really a major performance difference between doing the following: import Tkinter as TK TK.Label(yada yada) OR from Tkinter import * Label(yada yada) I'm unable to tell a real difference other than in the code writing :-). Thanks, Harlin --

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Diez B. Roggisch
Is there really a major performance difference between doing the No. I'm unable to tell a real difference other than in the code writing :-). The difference is that the from-syntax may cause name space pollution. See the FAQ: http://www.python.org/doc/faq/programming.html#id12 -- Regards,

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Michael Hoffman
Diez B. Roggisch wrote: [Harlin Seritt]: Is there really a major performance difference between doing the No. Actually, if you are using a name in another module repeatedly in an inner loop, it can make a big difference if you have to lookup the name in the module repeatedly. In that case, just

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Max M
Michael Hoffman wrote: But don't do from Tkinter import * for the reasons Diez has identified in the FAQ. It is so annoying to read some code and having to guess from where the do_complicated_stuff() function is imported from. Explicit importing is by far the moste preferable. -- hilsen/regards

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Diez B. Roggisch
Actually, if you are using a name in another module repeatedly in an inner loop, it can make a big difference if you have to lookup the name in the module repeatedly. In that case, just explicitly import the name you want to use repeatedly: Ok - but if that really hits the wall for some part

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Peter Hansen
Diez B. Roggisch wrote: I'm unable to tell a real difference other than in the code writing :-). The difference is that the from-syntax may cause name space pollution. See the FAQ: http://www.python.org/doc/faq/programming.html#id12 Ultimately more important than mere pollution are the latent

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Paul Rubin
Peter Hansen [EMAIL PROTECTED] writes: Ultimately more important than mere pollution are the latent problems this can cause if any of the names in the original module can ever be re-bound. You know, this is another reason the compiler really ought to (at least optionally) check for such

Re: Explicit or general importing of namespaces?

2005-02-28 Thread Nick Craig-Wood
Paul Rubin http wrote: Peter Hansen [EMAIL PROTECTED] writes: Ultimately more important than mere pollution are the latent problems this can cause if any of the names in the original module can ever be re-bound. You know, this is another reason the compiler really ought to (at least