如何处理 "un-importing" 单个模块?

How would one go about "un-importing" a SINGLE module?

出于好奇,如何去 un-importing 一个模块?

例如,您像这样导入几个模块:

import x, y, z

然后说出于某种原因您不想和/或不再需要包含模块 y,您将如何 un-import 模块 y 不影响模块 xz?

提前谢谢你。

来自文档:

Import statements are executed in two steps: (1) find a module, and initialize it if necessary; (2) define a name or names in the local namespace (of the scope where the import statement occurs).

如果您临时需要一个模块并且担心弄乱全局命名空间,您可以在本地范围内导入,全局命名空间不会受到影响。

据我所知,import 语句的第一步无法撤消。