Terry J. Reedy added the comment:
Another good reason for delaying an import is when the import is only needed
for testing.
In module_x
...
def callable_x(parent) # htest #
from tkinter import Toplevel
box = Toplevel(parent)
...
if __name__ == '__main__':
from unittest import main
main('idlelib.idle_test.test_module_x', verbosity=2)
from idlelib.idle_test.htest import run
run(callable_x)
This should be part of 'Import Standards' in idlelib.README.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue27892>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com