How to Write a DSL (in Python with Lark)

The first time I used Logo, it felt like magic. I could type a short sequence of simple commands, and draw beautifully complex shapes on the screen. In this tutorial, I will show you how to parse and interpret a Logo-like language in just 70 lines of code… Read more

Similar

The fastest way to flatten a list in Python

In my latest book, Fast Python, I bust a lot of speed myths in Python. Some of the most basic advice people give about optimizing Python code is wrong, likely because no one ever bothered to test it. In this book, I go back to the basics and verify (or bu... (more…)

Read more »

Why does dict raise keyerror rather than return a sentinel value? (Python) [video]

Upcoming events: https://learning.dutc.io/Discord: https://discord.gg/ZhJPKYSfNpDUTC Weekly: https://bit.ly/expert-pythonTwitter: https://twitter.com/dutc_tr... (more…)

Read more »