#pythonquest

Python PeakPythonPeak
2026-01-25

What is a generator in Python?

A generator is a function that uses yield instead of return. It returns an iterator that produces values one at a time, only when needed. Generators are memory efficient because they generate values on-the-fly instead of storing them all in memory. You use generators for large datasets or infinite sequences.

...

youtube.com/watch?v=zC4LKQoTnas

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst