YoVDO

When to Refactor Your Code into Generators and How

Offered By: PyCon US via YouTube

Tags

PyCon US Courses Fibonacci Sequence Courses

Course Description

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore techniques for refactoring code into generators in this 27-minute PyCon US talk by Jan-Hein Bührman. Learn how to identify common loop patterns and transform them into more maintainable and Pythonic code using generator functions. Discover how to combine custom generators with standard library tools and third-party packages to create efficient code pipelines. Follow along with a practical example using the Fibonacci sequence to understand the before-and-after effects of generator-based refactoring. Gain insights into recognizing opportunities for this refactoring pattern and improving code maintainability. Access accompanying slides for visual reference and additional details on the concepts presented.

Syllabus

Intro
GOALS
TOPICS
VARIATIONS ON FIBONACCI NUMBER SELECTIONS
FIBONACCI NUMBER (DEFINITION)
FIBS LESS THAN N (PYTHON)
SMALLEST FIB GREATER/EQUALN(PYTHON)
THE PATTERN
TIME TO START REFACTORING YOUR CODE
CODE REFACTORING
EXTRACTING COMMON PARTS NOT DOABLE!
EXPERIMENT: COMBINE THE FIRST TWO FUNCTIONS
REFACTORING THE RIGHT WAY: SINGLE RESPONSIBILITY
CONTEXT SWITCH: GENERATOR FUNCTIONS
THE FIBONACCI NUMBER GENERATOR
EXAMPLE USAGE OF THE FIBONACCI GENERATOR
THE SMALLEST FIB GREATER/EQUAL N (PYTHON, REFACTORED)
RECAP


Taught by

PyCon US

Related Courses

Introduction to Algorithms and Data structures in C++
Udemy
Fundamentals of Dynamic Programming
LinkedIn Learning
Discrete Math
Math at Andrews via YouTube
Big O Notation - Full Course
freeCodeCamp
Why Don't They Teach Newton's Calculus of What Comes Next?
Mathologer via YouTube