Hi all, You can do:
def foo(): "foodoc" pass function = type(lambda:0) foo2 = function(foo.__code__, globals()) assert foo2.__doc__ == "foodoc" I am wondering how the function constructor knows that foo.__code__ has a docstring. I can see that foo.__code__.co_consts == ('foodoc',) But I can't find where in foo.__code__ is stored the information that the first constant in foo.__code__ is actually a docstring. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list