Re: advanced module/import/namespace idioms

2005-12-31 Thread Scott David Daniels
chuck wrote: > Every once in awhile I run across a python module that might have > statements like: > > for c in sys.modules[module].__dict__.values(): Straight-forwardly imported modules wind up in sys.modules, keyed by their module name. So "t = sys.modules['name']" is like "import name as t"

advanced module/import/namespace idioms

2005-12-31 Thread chuck
Every once in awhile I run across a python module that might have statements like: for c in sys.modules[module].__dict__.values(): or import __builtin__ __builtin__.__dict__['_'] = lambda x: x Snurf also does some strange import trickory (see http://bdash.net.nz/svn/snurf/trunk/snurf/dataStore/