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.
-- http://mail.python.org/mailman/listinfo/python-list