TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Python Meta Circular Interpreter (2019)

47 pointsby leonry5 months ago

3 comments

upghost5 months ago
Er, to be clear, this just seems to be an interpreter -- not a meta circular interpreter. I don&#x27;t see any evidence that it is able to evaluate its own definitions or its own API. It doesn&#x27;t have any tools to handle class definitions, object instantiation, or method invocation, so I&#x27;m not sure by what definition of &quot;meta circular&quot; this interpreter fits.<p>Not trying to knock the project. Very cool code! Just don&#x27;t understand how it qualifies as a &quot;meta circular&quot;.
评论 #42449966 未加载
评论 #42450149 未加载
albertzeyer5 months ago
In Python, some of the stated use cases, like extracting coverage, extracting the call graph, etc, you can get via tracing already (sys.settrace, <a href="https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;sys.html#sys.settrace" rel="nofollow">https:&#x2F;&#x2F;docs.python.org&#x2F;3&#x2F;library&#x2F;sys.html#sys.settrace</a>).<p>And I would argue, the other stated use cases are maybe interesting to play around with, but nothing you really would want in production (I suppose).<p>Some of the other use cases, you can also achieve by module import hooks and rewriting the AST. (E.g. see how PyTest rewrites the assertion AST to produce nice error messages: <a href="https:&#x2F;&#x2F;github.com&#x2F;pytest-dev&#x2F;pytest&#x2F;blob&#x2F;main&#x2F;src&#x2F;_pytest&#x2F;assertion&#x2F;rewrite.py">https:&#x2F;&#x2F;github.com&#x2F;pytest-dev&#x2F;pytest&#x2F;blob&#x2F;main&#x2F;src&#x2F;_pytest&#x2F;a...</a>)
评论 #42455185 未加载
评论 #42449694 未加载
albertzeyer5 months ago
Somewhat similar: My PyCPython project (<a href="https:&#x2F;&#x2F;github.com&#x2F;albertz&#x2F;PyCPython">https:&#x2F;&#x2F;github.com&#x2F;albertz&#x2F;PyCPython</a>), where I wrote a C interpreter in Python, and then tried to interpret CPython. I never really completed this project though.