Python Generators: Lazy Iteration with yield
How yield turns a function into a generator, why generators use almost no memory, and how to build lazy data pipelines with them in Python.
Follow along
RSS lets you follow Code Academy without an account, emails or tracking. New articles appear in your reader as soon as they're published.
https://code-academy.ir/en/feed.xml
RSS is a simple, open standard for following websites. Instead of checking back for new posts, your reader collects them for you, and you can unsubscribe at any time.
RSS
How yield turns a function into a generator, why generators use almost no memory, and how to build lazy data pipelines with them in Python.
What a closure really is, how a JavaScript function keeps its variables after the outer function returns, and the patterns and bugs closures cause.
Most shell scripts work fine until a file name has a space in it or a command fails halfway through. Learn strict mode, quoting, safe temporary files and cleanup traps, then put it all together in a real backup script.
Why does a resolved promise always beat setTimeout(fn, 0)? Learn exactly how the event loop schedules tasks, microtasks and repaints, and how to keep long work from freezing the page.
When two CSS rules disagree, the browser follows a strict set of rules to pick a winner. Learn how the cascade decides, calculate specificity by hand, and stop reaching for !important.