> (Two different classes with the same name created - one from __main__ and > one from real_name.) Use cases for *genuinely* reimporting the same module > with different names (as different module objects rather than aliases) are > relatively rare, and the problem of modules *accidentally* reimporting > themselves not that rare.
That particular issue can be resolved by automatically doing the shadowing at the sys.module level though (i.e. insert into sys.modules under the real module name as well as __main__ for runpy._run_module_as_main and just strip the directory and extension details from __file__ to determine where to insert the second reference for a directly executed script file). Making sure both __main__ and the corresponding importable name refers to the same module object seems reasonable. Trying to special case shadowing detection just because the shadowing module happens to also be the main module seems ugly as hell :) Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com