[PyQt] import speed overhead question

Linos info at linos.es
Wed Nov 21 23:33:33 GMT 2007


Hello all,
	i have a question about speed optimization with PyQt, i cant find any clear explanation about this question
in google, i am developing an app with many .py files, in the beginning i am using this imports.

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtSql import *

to have no problem using classes but i would like to post any questions i suppose any people on the list have
to know:

1- if i import a file and this file import the same, it is imported two times wasting the same time in the
same imports other time?

main.py
	from PyQt4.QtCore import *
	from PyQt4.QtGui import *
	from PyQt4.QtSql import *
	import testdlg

testdlg.py
	from PyQt4.QtCore import *
	from PyQt4.QtGui import *
	from PyQt4.QtSql import *


2- i have changed any files to import like this:

from PyQt4.QtCore import QRegExp, QString, Qt, SIGNAL, SLOT, QVariant, QChar
from PyQt4.QtGui import QLabel, QDialog, QLineEdit, QDialogButtonBox, QGridLayout, QMessageBox, QApplication,
QIcon, QInputDialog
from PyQt4.QtSql import QSqlQuery

i know other people (and pyuic4) use this :

from PyQt4 import QtCore

and later use ever first QtCore in classes names "QtCore.QString" but i dont like to write too much
unnecessary code when i know i will not have name collision, any other way to speed up the imports?

3- is this really important to speed up the application?

Best Regards,
Miguel Angel.


More information about the PyQt mailing list