ncf wrote:
> I have a feeling that this is highly unlikely, but does anyone in here
> know if it's possible to directly call a module, or will I have to wrap
> it up in a class?

You could use trickery with sys.modules to automatically wrap it in a class:

import sys
from types import ModuleType

class CallableModule(ModuleType):
    def __call__(self):
        print "You called me!"

mod = FooModule(__name__, __doc__)
mod.__dict__.update(globals())
sys.modules[__name__] = mod
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to