Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Type Hints - Putting More Buzz in Your Fizz

PyCon US via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore type hints in Python and their importance in the ecosystem through this 37-minute PyCon US sponsor workshop. Learn how to implement type hints incrementally, use tools like mypy for checking, and incorporate them into CI/CD pipelines. Dive into hands-on examples, starting with simple cases and progressing to complex data structures, circular type references, and debugging techniques. Discover easy ways to add type hints to class definitions using typing.NamedTuple and @dataclass decorator. Gain insights on writing stubs for libraries without type hints and when to use the type: ignore comment. Apply these concepts to enhance the classic Fizz-Buzz game, refactoring code for clarity and simplicity while addressing common sources of complexity in type hinting.

Syllabus

Intro
Topics
Some basic tooling - mypy and fox
Installing and Running
Sample Project
A simple case
The Fizz-Buzz Party Game-Sit in a circle and count
A Fizz Buzz Solution fizzbuzz2.py
A Fizz Buzz Solution With Hints
A Fizz Buzz Solution With Erroneous Hints
Two Paths Forward
Design Strategies
Dealing with complex data structures
We really wanted a mapping from number to fizz-buzz text
Some code
mypy needs some convincing
Adding clarity
Refactoring Phase 1: Simplify the Types
Refactoring Phase II: Propagate the Simplifications
Forward references and circularity
Two Classes with Mutual References
Don't Panic
Here's the state of a number, FBState
Debugging
Some Example Code
Common Sources of Complexity
More Buzz in your Fizz

Taught by

PyCon US

Reviews

Start your review of Type Hints - Putting More Buzz in Your Fizz

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.