I proposed PEP 511 "API for code transformers" for Python 3.6 (in
2016) and it was rejected:
This PEP was rejected by its author.
This PEP was seen as blessing new Python-like programming languages
which are close but incompatible with the regular Python language. It
was decided to not promote syntaxes incompatible with Python.
This PEP was also seen as a nice tool to experiment new Python
features, but it is already possible to experiment them without the
PEP, only with importlib hooks. If a feature becomes useful, it should
be directly part of Python, instead of depending on an third party
Finally, this PEP was driven was the FAT Python optimization project
which was abandoned in 2016, since it was not possible to show any
significant speedup, but also because of the lack of time to implement
the most advanced and complex optimizations.
IMO the most important part of the PEP 511 was to change the pyc
filename depending on the code transformer used to modify the code.
On Mon, Apr 19, 2021 at 8:21 PM Luciano Ramalho
How about leveraging the `# coding=<encoding name>` hook that exists since 2001 to enable the alternative syntax some are advocating for type hints?
PEP 263—Defining Python Source Code Encodings https://www.python.org/dev/peps/pep-0263/
I've seen experiments in the wild using that to support syntax extensions to Python. Just for fun, years ago I wrote a POC for Sucuri—a Python dialect with the keywords in Portuguese. The pre-processor simply replaced the Portuguese keywords with the English ones.
-- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Technical Principal at ThoughtWorks | Twitter: @ramalhoorg _______________________________________________ Python-Dev mailing list -- firstname.lastname@example.org To unsubscribe send an email to email@example.com https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://firstname.lastname@example.org/message/XRLAOOIJ... Code of Conduct: http://python.org/psf/codeofconduct/
-- Night gathers, and now my watch begins. It shall not end until my death.