Get the latest tech news

Adding syntax to the CPython interpreter


2024-10-17 Condensed version of this cool blog post. Let's add some new syntax to Python! Making a small change is not so hard.

Our aim is to make ternary statements default to None as they do in Ruby: Now let's run the Python interpreter we built and check it works: Now lets's change the grammar so that if we don't have an else condition we default to None.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of syntax

syntax

Photo of CPython interpreter

CPython interpreter

Related news:

News photo

Markdown is meant to be shown (2021)