Hello, On Tue, 20 Apr 2021 11:08:56 +0200 Victor Stinner <vstinner@python.org> wrote:
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
Well, it wasn't rejected, it was self-rejected on the thought-crime grounds. It's however a big philosophical question what's worse for Python - adding questionable re: implementation aspects features (PEP649), NIH way to handle exceptions (PEP654) (a couple of random examples, really), - or embrace macro-level extensibility, which is usually a part of any advanced programming language out there. (And which is de-facto available for Python either). []
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.
Right, for "production" macro usage, the question of tracking macro dependencies for precompiled bytecode (and invalidating it if dependencies changed) is important. PEP 638 (https://www.python.org/dev/peps/pep-0638/) also touches on that, but I also don't see it to be well thought out/articulated. Instead of adhoc version/flavor identifiers (which in large-scale will likely lead to version hell as we know), it literally should be that a .pyc file can depend on multiple (not one, like now) .py files (or maybe module names). [] -- Best regards, Paul mailto:pmiscml@gmail.com