Ryan wrote:
[....] It does beg the question for
me. Consider the example from his code below

from PyQt4 import QtGui

class LauncherWidget( QtGui.QWidget ):
    # A Specialization of QWidget

del QtGui

Next time python comes across

from PyQt4 import QtGui

it would have to re-import the class, which seems a waste of cycles
that could accumulate.

Errrhm, no.  He is not deleting the PyQt4 module from sys.modules;
he's only deleting the name QtGui from his own namespace.  Next
time Python comes across

    from PyQt4 import QtGui

, it finds that the module PyQt4 already exists in sys.modules, so
Python does not have to load the module again.  All it has to do is
bind name QtGui in the importing module to the class with the same
name in the PyQt4 module.  That does not take many cycles.


-- HansM
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to