We had a similar thing at Dropbox, where `# coding: pyxl` would enable a preprocessor that allowed HTML embedded in the Python code. It translated this to function calls and string literals.
There were however several drawbacks:
- Installing the codec is a bit tricky, and if you don't have it the code can't run
- Other tooling won't know about the new syntax (someone went through heroic efforts to write a PyCharm extension for pyxl but it got stale very quickly)
- The codec slows down the import process
- Keeping line numbers accurate in the codec is painful
- Occasionally, when debugging mysteries, you end up needing to see the source code after preprocessing, which requires yet another custom tool
In the end the project was withdrawn and we switched to more mainstream templating solutions.
I suspect that many of the issues with pyxl would also plague using this approach as a way to customize typing syntax, and I don't think it would be an improvement over the status quo.