[Python-Dev] sys.modules["__main__"] in Jython

Finn Bock bckfnn@worldonline.dk
Fri, 08 Jun 2001 19:15:14 GMT


[Skip]

>Would someone with Jython experience check to see if it interprets
>sys.modules["__main__"] in the same manner as Python?

To me it seems like Jython defines sys.modules["__main__"] in the same
way as CPython. 

>I'm wondering if this works for Jython as well as Python:
>
>    def _test():
>	import doctest, sys
>	return doctest.testmod(sys.modules["__main__"])
>
>    if __name__ == "__main__":
>	_test()

It works for Jython.

regards,
finn