High Order Python — Part 5

📰 Medium · Python

Generators: Lazy is the New Smart Continue reading on Engineering Playbook »

Published 13 Apr 2026

Full Article

Title: High Order Python — Part 5

URL Source: https://medium.com/engineering-playbook/high-order-python-part-5-1fc3cc288831?source=rss------python-5

Published Time: 2026-04-13T03:07:10Z

Markdown Content:
# High Order Python — Part 5. Generators: Lazy is the New Smart | by ez7 | Apr, 2026 | Medium

[Sitemap](https://medium.com/sitemap/sitemap.xml)

[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)

Sign up

[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fez7.medium.com%2Fhigh-order-python-part-5-1fc3cc288831&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

[](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)

Get app

[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)

[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)

Sign up

[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fez7.medium.com%2Fhigh-order-python-part-5-1fc3cc288831&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

![Image 1](https://miro.medium.com/v2/resize:fill:32:32/1*dmbNkD5D-u45r44go_cf0g.png)

Member-only story

# High Order Python — Part 5

## Generators: Lazy is the New Smart

[![Image 2: ez7](https://miro.medium.com/v2/resize:fill:32:32/1*dmbNkD5D-u45r44go_cf0g.png)](https://medium.com/?source=post_page---byline--1fc3cc288831---------------------------------------)

[ez7](https://medium.com/?source=post_page---byline--1fc3cc288831---------------------------------------)

Follow

7 min read

·

Just now

[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fvote%2Fp%2F1fc3cc288831&operation=register&redirect=https%3A%2F%2Fez7.medium.com%2Fhigh-order-python-part-5-1fc3cc288831&user=ez7&userId=58bee161c701&source=---header_actions--1fc3cc288831---------------------clap_footer------------------)

[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fbookmark%2Fp%2F1fc3cc288831&operation=register&redirect=https%3A%2F%2Fez7.medium.com%2Fhigh-order-python-part-5-1fc3cc288831&source=---header_actions--1fc3cc288831---------------------bookmark_footer------------------)

[Listen](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2Fplans%3Fdimension%3Dpost_audio_button%26postId%3D1fc3cc288831&operation=register&redirect=https%3A%2F%2Fez7.medium.com%2Fhigh-order-python-part-5-1fc3cc288831&source=---header_actions--1fc3cc288831---------------------post_audio_button------------------)

Share

Press enter or click to view image in full size

![Image 3](https://miro.medium.com/v2/resize:fit:700/1*IJ-5AlqhfwW5yOPrYhFUKg.png)

Python Generator

In the first four posts ([Functions](https://medium.com/@ez7/high-order-python-part-1-26cfc28f8afa), [Callbacks](https://medium.com/@ez7/high-order-python-part-2-f1594d28a6c4), [Dispatch Tables](https://medium.com/@ez7/high-order-python-part-3-11ac110a69f2), and [Memoization](https://medium.com/@ez7/high-order-python-part-4-d6dde18ae1c8)), we’ve been building functions that do their work eagerly — compute a result, return it, done. But what if you don’t want all the results at once? What if there are a million of them? What if there are _infinitely many_?

Python has an answer, and it’s one of the language’s best ideas: **generators**. A generator is a function that produces values one at a time, pausing between each one, resuming only when you ask for the next. It’s lazy computation built into the language, and it changes how you think about data processing.

[_Higher-Order Perl_](https://hop.perl.plover.com/)spends several chapters building lazy sequences
Read full article → ← Back to Reads