1
Day 10 homework
j edited this page 2023-04-19 11:45:22 +02:00

This is an extension to the day 9 homework.

First, rebase your branch onto the main branch of this repository: git rebase main.

  1. Run the module-inspector script, and fix any problems that prevent it from running.
  2. Look at the output. Notice that some of the module names seem similar, and are cached via two different loader methods.
  3. Based on what you see from the module-inspector script, modify your answer from question 10 from the day 9 homework, so the similar module names aren't counted multiple times.
  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.