Python * imports

I've generally been told that the following is bad practice.

from module import *

The main reasoning (or so I've been told), is that you could possibly import something you didn't want, and it could shadow a similarly named function or class from another module.

However, what about PyQt

from PyQt4.QtCore import *

Every example I've ever seen is written this way, mainly because everything exported from Qt starts with "Q", so it's not going to shadow anything.

What's the concensus? Is it always bad to use * imports?

EDIT:

Just to be clear, this question is specifically in regards to using PyQt4. It has nothing to do with the way I am designing some other project.

Basically, I've found that coding to PEP8 has improved my code readability, except with regards to importing PyQt4, and so I've disregarded the frowns from purists until now. But now my dev group is deciding on one convention and I'm wondering if this is a scenario "where practicality beats purity", or if I should just suck it up and deal with monstrous PyQt4 imports

from PyQt4.QtGui import QComboBox, QLineEdit, QLayout, Q;lakdfaf.......
12
задан CharlesB 25 February 2013 в 15:19
поделиться