[Python-Dev] Autoloading? (Making Queue.Queue easier to use) (original) (raw)

Michael Chermside mcherm at mcherm.com
Wed Oct 12 13:35:18 CEST 2005


Guido van Rossum writes: Code that doesn't need Queue but does use threading shouldn't have to pay for loading Queue.py.

Greg Ewing responds:

What we want in this kind of situation is some sort of autoloading mechanism, so you can import something from a module and have it trigger the loading of another module behind the scenes to provide it.

John Camera comments:

Bad idea unless it is tied to a namespace. So that users knows where this auto-loaded functionality is coming from. Otherwise it's just as bad as 'from xxx import *'.

John, I think what Greg is suggesting is that we include Queue in the threading module, but that we use a Clever Trick(TM) to address Guido's point by not actually loading the Queue code until the first time (if ever) that it is used.

I'm not familiar with the clever trick Greg is proposing, but I do agree that IF everything else were equal, then Queue seems to belong in the threading module. My biggest reason is that I think anyone who is new to threading probably shouldn't use any communication mechanism OTHER than Queue or something similar which has been carefully designed by someone knowlegable.

-- Michael Chermside



More information about the Python-Dev mailing list