Rust procedural macros can do amazing things, including implementing an entire dang Python feature from scratch. I've wanted to make this "lecture+tutorial" combo video for about a year and it took me about that long to get around to doing it--hope you enjoy and learn something.
We'll deep dive about macros in general, some compiler architecture stuff, and some thoughts on how to architect macros well. Then we'll talk about Python list/set/generator comprehensions and how to emulate them in Rust code, and then we'll write a macro that does exactly that for us. We'll meet some friends like syn and quote and we'll end up with a macro that is quite clean and yet quite powerful, if I do say so.
FULL VERSION of the implementation that handles multiple for-if-clauses:
https://gist.github.com/kepler-5/065346184523890310e38bcf9adff03e
I use the amazing Manim library for animating these videos, and I edit them with Blender and Audacity.
https://www.manim.community/
https://www.blender.org/
https://www.audacityteam.org/