On Jul 17, 2019, at 18:41, Yonatan Zunger <[email protected]> wrote: > > > I'm in the middle of developing a fancy heap profiler for Python (for those > times when tracemalloc isn't enough), and in the process, thought of a small > change in the interpreter which could have a lot of uses. I call it "scope > painting" because it lets you paint a label on an interpreter scope. > > Conceptual TL;DR: Add a function which attaches a string label to the current > interpreter frame. (This would go away when you either explicitly cleared it, > or the frame ended, i.e. the current function returned)
Can you get 90% of this by creating a global WeakKeyDictionary mapping frames to names, and monkey patching the relevant modules to use it? It might be too inefficient for some uses, but it seems like it should be good enough to demo the idea and show off some of the ways it could be used.
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/2WD5NHKLKKZEMCQ46CQPPS6BRPSMG662/ Code of Conduct: http://python.org/psf/codeofconduct/
