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:
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 com
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
Paul Rubin 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
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
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 pro
> 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 pa
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
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 ex
> 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
--
Regard
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
--
http://mail.python.org/mailman/listinfo
11 matches
Mail list logo