On Sat, 27 Sep 2008 17:41:42 -0400, Terry Reedy wrote: > In 3.0, at least, one does not need a disk file to create a module. > > >>> import types > >>> me = types.ModuleType('me') # type(__builtins__) works, no import > >>> me > <module 'me' (built-in)> > >>> me.a = 1 > >>> me.a > 1 > >>> me.a + 1 > 2
Seems to work for Python 2.5 as well. > That said, a blank class is even easier, and the representation is > better. And modules aren't callable. I've often thought they should be. -- Steven -- http://mail.python.org/mailman/listinfo/python-list