Update page 'Day 10 homework - Sloetjes '
@@ -79,7 +79,8 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
By using a set called `module_files` to keep track of the filenames of the modules that we have counted so far. Before counting a module, we check if its filename has been counted already. If it has, we skip the module and move on to the next one. This ensures that similar module names are counted only once.
|
By using a set called `module_files` to keep track of the filenames of the modules that we have counted so far. Before counting a module, we check if its filename has been counted already. If it has, we skip the module and move on to the next one. This ensures that similar module names are counted only once.
|
||||||
|
|
||||||
4. Inspect the `__loader__` attribute of each entry in the `sys.modules` dict. Can you find an attribute of `__loader__` which reliably tells you if the loader is source, builtin, or extension?
|
**4. Inspect the `loader` attribute of each entry in the `sys.modules` dict. Can you find an attribute of `loader` which reliably tells you if the loader is source, builtin, or extension?**
|
||||||
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?
|
|
||||||
|
|
||||||
Extra credit: use the freeze utility to turn the module-inspector script into a real app.
|
**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?**
|
||||||
|
|
||||||
|
**Extra credit: use the freeze utility to turn the module-inspector script into a real app.**
|
||||||
Reference in New Issue
Block a user