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

Sokolov Yura falcon at intercable.ru
Thu Oct 13 10:48:56 CEST 2005


May be allow modules to define __getattr__ ?

def __getattr__(thing):
     try:
          return __some_standart_way__(thing)
    except AttributeError:
          if thing=="Queue":
               import sys
               from Queue import Queue
               setattr(sys.modules[__name__],"Queue",Queue)
               return Queue
          raise




More information about the Python-Dev mailing list