Syllabus

  1. 01Function argumentsWrite functions that accept arguments flexibly: defaults without the mutable-default trap, *args, **kwargs, every parameter kind together, and unpacking with * and **.7 lessons
    1. 01Positional, keyword and default arguments
    2. 02The mutable default argument trap
    3. 03Any number of arguments with *args
    4. 04Any number of keyword arguments with **kwargs
    5. 05Combining parameter kinds and unpacking
    6. 06Project: festival scheduler
    7. 07Function arguments quiz
  2. 02Namespaces and scopeHow Python stores names: built-in, global, enclosing and local namespaces, the LEGB lookup rule, and changing outer variables with global and nonlocal.6 lessons
    1. 01Names and namespaces
    2. 02The built-in and global namespaces
    3. 03Local and enclosing namespaces
    4. 04Scope and the LEGB rule
    5. 05Changing outer variables: global and nonlocal
    6. 06Namespaces and scope quiz
  3. 03Functions deep diveTreat functions as values: dispatch tables, higher-order functions and factories, the built-in map, filter, reduce, sorted and friends, and decorators with and without arguments.6 lessons
    1. 01Functions are objects
    2. 02Higher-order functions
    3. 03Built-in higher-order functions
    4. 04Decorators
    5. 05Decorators with arguments and stacking
    6. 06Functions deep dive quiz
  4. 04Object-oriented programmingDesign with classes: inheritance and composition, overriding and super(), polymorphism and duck typing, special methods, abstract base classes and properties.9 lessons
    1. 01OOP and inheritance
    2. 02Shared class variables across subclasses
    3. 03Overriding methods and super()
    4. 04Polymorphism
    5. 05Special (dunder) methods
    6. 06Abstract base classes
    7. 07Encapsulation and properties
    8. 08Project: media library
    9. 09Object-oriented programming quiz
  5. 05Exceptions and unit testingHandle and design errors well, from the exception hierarchy to custom exceptions and chaining, then prove your code works with unittest: assertions, expected errors, subtests and fixtures.8 lessons
    1. 01The exception hierarchy
    2. 02Raising and defining exceptions
    3. 03else, finally and cleanup
    4. 04From manual checks to test functions
    5. 05Unit testing with unittest
    6. 06Assertion methods, errors and subtests
    7. 07Fixtures, skipping and expected failures
    8. 08Exceptions and unit testing quiz
  6. 06Iterators and generatorsSee how iteration works under the hood, write your own iterators, use itertools, and produce data lazily with generator functions, expressions, pipelines and send().7 lessons
    1. 01Iterables and iterators
    2. 02Writing your own iterators
    3. 03The itertools toolkit
    4. 04Generator functions
    5. 05Generator expressions, pipelines and yield from
    6. 06Talking to generators: send, throw and close
    7. 07Iterators and generators quiz
  7. 07Specialized collectionsPick the right container: sets and frozensets, deque, namedtuple, defaultdict and Counter, OrderedDict and ChainMap, and your own containers built on UserDict and UserList.8 lessons
    1. 01Sets and frozensets
    2. 02deque: a double-ended queue
    3. 03namedtuple: tuples with field names
    4. 04defaultdict and Counter
    5. 05OrderedDict and ChainMap
    6. 06Custom containers with UserDict, UserList and UserString
    7. 07Project: delivery dispatch board
    8. 08Specialized collections quiz
  8. 08Resource managementRelease files, connections and other resources reliably with the with statement: write context manager classes, handle exceptions in __exit__, build managers from generators, and combine several at once.6 lessons
    1. 01Resources and the with statement
    2. 02Writing a context manager class
    3. 03Handling exceptions in __exit__
    4. 04Context managers from generators
    5. 05Combining context managers
    6. 06Resource management quiz