I proposed PEP 511 "API for code transformers" for Python 3.6 (in 2016) and it was rejected: https://www.python.org/dev/peps/pep-0511/#rejection-notice """ 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 Python module. 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. Victor On Mon, Apr 19, 2021 at 8:21 PM Luciano Ramalho <luciano@ramalho.org> wrote:
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.
Cheers,
Luciano
-- 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 -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.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.