Hello, On Mon, 19 Apr 2021 20:23:08 -0700 Guido van Rossum <guido@python.org> wrote: []
How does this "similar thing" compare to the recently announced imphook module?
For one, pyxl is a better name. :-)
I would humbly disagree ;-).
Seriously, as long as the purpose is to allow using a different grammar (for part of the file) that is then transpiled to proper Python, all but the first issue apply exactly the same.
That's one of the biggest differences - imphook (https://pypi.org/project/imphook/) written with the idea that macro capabilities have always been first-class citizen of the Python ecosystem (well, maybe 25 years of its 30 years). But it's also written with the full understanding and acknowledgment that there's a disconnect between advanced Python users, who have been using Python macro capabilities for decades, and mainstream community. For the latter, the use of these facilities was always complicated and esoteric. And given the attitude of some core CPython developers (examples: self-policing like in PEP511 or telling pyxl anecdotes), there's suspicion that the state of complication and confusion is held on the purpose (of course, with the good intentions of saving users from even more confusion).
Getting the hook to run (my first bullet) actually sounds *more* complicated, because you have to include code in your `__main__` module that installs the hook(s).
Right, importing a module is a complicated task for Python users, or should be presented as such. Well, then there's also a runner which allows to not patch your code to use macro facilities: python3 -m imphook -i mod_conf example_conf.py But that's command line, so of course it's still complicated. Well, maybe not that much, and people who were able to deal with "python2", "python3", "python3.5", "python3.6", "py", etc. can deal with that too.
But I have zero experience with imphook, I just skimmed its PyPI home page, which has an example that calls ``` imphook.add_import_hook(hook, (".conf",)) ```
That's the code which needs to be run by "macro" implementations, not by users of a particular "macro". -- Best regards, Paul mailto:pmiscml@gmail.com