Update page 'Day 10 homework - Sloetjes '
@@ -116,8 +116,8 @@ Module directory histogram:
|
|||||||
**5. Add `import pandas` to the top of the module-inspector script and re-run it. Notice that many of the pandas modules are not loaded using the `SourceFileLoader`. Can you explain why these modules are different?**
|
**5. Add `import pandas` to the top of the module-inspector script and re-run it. Notice that many of the pandas modules are not loaded using the `SourceFileLoader`. Can you explain why these modules are different?**
|
||||||
|
|
||||||
##### Answer:
|
##### Answer:
|
||||||
* This is because Pandas is a large library with many sub-modules and sub-packages, and some of these sub-modules and sub-packages are implemented using compiled extensions written in C or C++. These extensions are loaded dynamically at runtime by Python's import machinery, and therefore they are not loaded using the SourceFileLoader like pure Python modules are.
|
* This is because Pandas is a large library with many sub-modules and sub-packages, and some of these sub-modules and sub-packages are implemented using compiled extensions written in C or C++. These extensions are loaded dynamically at runtime by Python's import machinery, and therefore they are not loaded using the `SourceFileLoader` like pure Python modules are.
|
||||||
* When a Python module contains compiled extensions, Python uses a different type of loader called an "extension loader" to load the module. Extension loaders are responsible for loading compiled binary code that is specific to the operating system and architecture of the system running Python. These loaders are typically implemented using the operating system's dynamic loading facilities (e.g., dlopen() on Unix-like systems, or LoadLibrary() on Windows).
|
* When a Python module contains compiled extensions, Python uses a different type of loader called an "extension loader" to load the module. Extension loaders are responsible for loading compiled binary code that is specific to the operating system and architecture of the system running Python.
|
||||||
* In the case of Pandas, many of the sub-modules and sub-packages are implemented using compiled extensions, and therefore they are loaded using an extension loader rather than the SourceFileLoader. This is why you see a mix of different types of loaders in the loader column when you run the module-inspector script on a system that has Pandas installed.
|
* In the case of Pandas, many of the sub-modules and sub-packages are implemented using compiled extensions, and therefore they are loaded using an extension loader rather than the `SourceFileLoader`. This is why we see a mix of different types of loaders in the `loader` column when we run the module-inspector script on a system that has Pandas installed.
|
||||||
|
|
||||||
**Extra credit: use the freeze utility to turn the module-inspector script into a real app.**
|
**Extra credit: use the freeze utility to turn the module-inspector script into a real app.**
|
||||||
Reference in New Issue
Block a user