On 2/8/06, adam johnson <[EMAIL PROTECTED]> wrote: > Hi All. > I was wondering why defining a __call__ attribute for a module doesn't make > it actually callable. > > I don't have any reason for doing so, I was just wondering if it worked, and > found out it didn't. > > $ cat mod.py > """ > Test callable module > """ > def __call__(): > return "in mod.__call__" > > > >>> import mod > >>> mod() > Traceback (most recent call last): > File "<stdin>", line 1, in ? > TypeError: 'module' object is not callable > >>> mod.__call__() > 'in mod.__call__' > > > Thanks for any replies, Adam. > >
I remebered that __call__() is just used for class, but not module. Am I wrong? -- I like python! My Blog: http://www.donews.net/limodou NewEdit Maillist: http://groups.google.com/group/NewEdit -- http://mail.python.org/mailman/listinfo/python-list