고래밥 이야기
Python_The import system 본문
다음을 참고하였습니다.
5. The import system — Python 3.11.0 documentation
5. The import system — Python 3.11.0 documentation
Python code in one module gains access to the code in another module by the process of importing it. The import statement is the most common way of invoking the import machinery, but it is not the only way. Functions such as importlib.import_module() and b
docs.python.org
import
- Python code in one module gains access to the code in another module by the process of importing it.
- 1. it searches for the named module, then 2. it binds the results of that search to a name in the local scope.
Packages (regular packages & namespace packages)
- You can think of packages as the directories on a file system and modules as files within directories, but don’t take this analogy too literally since packages and modules need not originate from the file system.
- Packages are just a special kind of module. Specifically, any module that contains a __path__ attribute is considered a package.
Regular Packages
- A regular package is typically implemented as a directory containing an __init__.py file.
Name Packages
- Namespace packages may or may not correspond directly to objects on the file system; they may be virtual modules that have no concrete representation.
'잡다 > 잡다 그 잡채' 카테고리의 다른 글
Python_class (0) | 2022.11.09 |
---|---|
Python_def (0) | 2022.11.09 |
Python_inner product (1) | 2022.11.09 |
Python_module (0) | 2022.11.09 |
python_%timeit (0) | 2022.10.31 |