[Python-ideas] Python dialect that compiles into python

Steven D'Aprano steve at pearwood.info
Fri Sep 7 20:28:29 EDT 2018

On Fri, Sep 07, 2018 at 11:57:50AM +0000, Robert Vanden Eynde wrote:

> Many features on this list propose different syntax to python, 
> producing different python "dialects" that can statically be 
> transformed to python :

> Using a modified version of ast, it is relatively easy to modifiy the 
> syntax tree of a program to produce another program. So one could 
> compile the "python dialect" into regular python. The last example 
> with partially for example doesn't even need new syntax.

> Actually, I might start to write this lib, that looks fun.

I encourage you to do so! It would be great for non-C coders to be able 
to prototype proposed syntax changes to get a feel for what works and 
what doesn't.

There are already a few joke Python transpilers around, such as 
"Like, Python":


but I think this is a promising technique that could be used more to 
keep the core Python language simple while not *entirely* closing the 
door to people using domain-specific (or project-specific) syntax.


More information about the Python-ideas mailing list