Python for Programmers

Contents

  • The Test Framework
  • Mutability misconceptions
  • Objects are the star of the show
  • Funky functions
  • Iterables: what are they good for?
  • Classes and Modules
  • Ducks and protocols
  • Review
  • Further Resources
  • Exercise Answers

Taught by Trey Hunner of Truthful Technology LLC. Practice Python weekly.

Python for Programmers

Python for Programmers

Contents

  • The Test Framework
    • Confirm the Framework is Working
    • How to Solve the Exercises
    • How to Run the Tests
    • Additional Testing Techniques
  • Mutability misconceptions
    • What is an assignment?
    • Variables are not buckets
    • Assignments versus mutations
    • Augmented assignments
    • Thinking about this further
    • Mutability Exercises
  • Objects are the star of the show
    • Remember: variables point to objects
    • Objects contain pointers
    • Avoiding accidental references
    • An ouroboros list
    • Little contracts everywhere
    • Contracts for everything
    • Object Exercises
  • Funky functions
    • Lambda
    • First-class functions
    • Lambda is limiting
    • Do you even need a function?
    • Callables are the key
    • Decorators
    • Function Exercises
  • Iterables: what are they good for?
    • What is an iterable?
    • Types of iterables
    • List Comprehensions
    • Lazy iterables
    • All iteration is the same
    • Layers on top of iteration
    • Iterators
    • How for loops work
    • Generators
    • Iterable Exercises
  • Classes and Modules
    • Classes wrap around a dictionary
    • Methods are just functions that live on a class
    • Attributes live in a dictionary
    • Properties
    • Metaclasses
    • Modules
    • Scripts
    • Class Exercises
  • Ducks and protocols
    • Custom collections
    • Protocols
    • Duck typing
    • When we type check
    • Goose typing
    • Slippery ducks
    • Abstract base classes
    • Protocol Exercises
  • Review
  • Further Resources
  • Exercise Answers
    • Mutability Exercises
    • Object Exercises
    • Function Exercises
    • Iterable Exercises
    • Class Exercises
    • Protocol Exercises

Exercises

Exercise test files

Next

© Copyright 2024 Trey Hunner.