Review

Some takeaways:

  • Objects are the star of the show
    • Variables simply point to objects (all variables are pointers)

    • Everything is an object in Python (even functions, classes, and modules)

  • Dunder variables act as a contract between the Python interpreter and the developers of each Python object

  • Think in terms of iterables when looping. We tend to loop over iterables rather than loop based on conditions.

  • We think and talk in terms of behavior in Python, not so much in terms of types. Nouns that describe verbs are a big deal! It’s all about duck typing.

Less notable takeaways:

  • “Functions” are less important than “callables” (we often use the word “function” to mean “any object you can call)

  • First-class functions are important, but lambda functions are less important

  • The “iterator” protocol means iterables may not be indexable, reversible, or even finite!

  • Lazy looping with generators and iterators is a way to save memory and sometimes CPU