Most AI Pilots Fail to Scale. MIT Sloan Teaches You Why — and How to Fix It
Finance Certifications Goldman Sachs & Amazon Teams Trust
Overview
Google, IBM & Meta Certificates — All 10,000+ Courses at 40% Off
One annual plan covers every course and certificate on Coursera. 40% off for a limited time.
Get Full Access
Explore the concept of constants in Python through a comprehensive 24-minute video tutorial. Discover when and why to use constants instead of variables, and learn three practical implementations: frozen dataclasses, raising TypeError in __setattr__, and using typing.final. Gain insights into Python's design philosophy regarding constants and understand how to incorporate them into your programming toolkit. Follow along with code examples and explanations of the benefits and advantages of using constants in Python programming.
Syllabus
Intro
Background: const vs var
Why / when to use constants const?
Benefits / Advantages of const
dataclasses' frozen param Frozen dataclasses
raise TypeError in __setattr__
python's design philosophy on const
typing.final / @final decorator
from typing import Final typecheck
summary including const into your python programming toolkit
Taught by
Samuel Chan