YoVDO

Constants in Python: Implementation and Best Practices

Offered By: Samuel Chan via YouTube

Tags

Python Courses Object-oriented programming Courses Data Structures Courses

Course Description

Overview

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

Related Courses

Artificial Intelligence for Robotics
Stanford University via Udacity
Intro to Computer Science
University of Virginia via Udacity
Design of Computer Programs
Stanford University via Udacity
Web Development
Udacity
Programming Languages
University of Virginia via Udacity