On Wed, 2 Dec 2020 07:47:53 +1100 Steven D'Aprano firstname.lastname@example.org wrote:
On Tue, Dec 01, 2020 at 06:53:35PM +0300, Paul Sokolovsky wrote:
I also forgot to mention very important point in the intro: when you read this proposal, please don't think about "CPython". That for sure will send you the wrong vibes. Think about "Python". ;-)
I never think *only* of CPython when reading PEPs. Unless the PEP is clearly and obviously about an implementation detail of CPython, I always read them as proposing a *Python* language change. Doesn't everyone?
But I don't understand your comment. Are you suggesting that CPython will be exempt from this proposal? Or that the proposal is aimed at helping alternative implementations?
I just think that some of people who think in terms of "Python" == "CPython", would have hard time imagining how this "strict mode" came by, if they will try to apply it the CPython situation.
I also don't think that it applies to CPython's approach well. If anything, it's kind of "contrarian" approach to how CPython tries to do things (e.g. https://www.python.org/dev/peps/pep-0509/).
Should we be thinking specifically of some alternate implementation?
I guess that the thinking in terms of "tabula rasa" would help. Like, if you forget all the existing CPython baggage, and just face a problem of optimizing name lookups, what would you do? This proposal is one such exploration.
Also Steven, it's literally the response I promised in our initial thread on the "const" annotation, https://email@example.com/message/SQTOWJ...
As you can see, it's much more far-fetched than just how to implement the runtime honoring of the "const" annotation. Because it tries to "extract" as much as possible already existing constness in Python programs, and then drafts how to use that to optimize lookups (en masse, as there're a lot of constness indeed).
If we only need to handle explicit "const" annotations, it's a pretty small subset of this proposal.
If not, then the purpose of this "very important point" isn't clear to me.