From e5f1197c8af52aaaf125149ed5e9d0ceda89a4f8 Mon Sep 17 00:00:00 2001 From: peterhinch Date: Sat, 14 Jan 2023 10:54:05 +0000 Subject: [PATCH] Add notes on import. --- import/IMPORT.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/import/IMPORT.md b/import/IMPORT.md index 59fedc9..188bd54 100644 --- a/import/IMPORT.md +++ b/import/IMPORT.md @@ -35,15 +35,13 @@ The file `my_library/foo.py` is only loaded when it becomes clear that the user and may be changed without affecting its API. The "lazy loader" is employed in -[uasyncio](https://github.com/micropython/micropython/tree/master/extmod/uasyncio). +[uasyncio](https://github.com/micropython/micropython/tree/master/extmod/uasyncio) making it possible to write ```python import uasyncio as asyncio e = asyncio.Event() # The file event.py is loaded now ``` -Files are loaded as required. - -The source code is in `__init__.py`: +Files are loaded as required. The source code is in `__init__.py`: [the lazy loader](https://github.com/micropython/micropython/blob/master/extmod/uasyncio/__init__.py). # 3. Wildcard imports @@ -55,9 +53,7 @@ from my_module import * needs to be treated with caution for two reasons. It can populate the program's namespace with unexpected objects causing name conflicts. Secondly all these objects occupy RAM. In general wildcard imports should be avoided unless the -module is designed to be imported in this way. - -For example issuing +module is designed to be imported in this way. For example issuing ```python from uasyncio import * ```