Classes and the Netflix Lab

Today we show a solution to the previous Netflix lab and discuss how inefficient our programs were because they repeatedly opened and searched files. Your instructor will then rewrite the solution to use a Netflix class instead, where the class opens the files at initialization, and then never again. The key to this approach is to use dictionaries to store the pieces of information we need (actors, shows, IDs), so that the netflix functions don't need to open the files, but instead just lookup their data directly from dictionaries.

You need to attend class since we're going over solutions. The code will not be posted publicly here. Reach out to your instructor if you are absent.

Today in Class

  1. Adapt an inefficient lab to use a class instead
  2. How to create dictionaries in the __init__() function
  3. Problem-solve with dictionaries