Re: From parsing a class to code object to class to mappingproxy to object (oh my!)

2019-04-06 Thread Gregory Ewing
adam.pre...@gmail.com wrote: I've figured from this that I could do most variable access by just generating LOAD/STORE_NAME and the FAST is an (important) optimization. Yes, that's possible, although access to intermediate scopes (i.e. nonlocal) will need something else. An important exceptio

Re: From parsing a class to code object to class to mappingproxy to object (oh my!)

2019-04-05 Thread adam . preble
On Friday, April 5, 2019 at 5:54:42 PM UTC-5, Gregory Ewing wrote: > But when compiling a class body, it uses a dict to hold the > locals, and generates LOAD_NAME and STORE_NAME opcodes to > access it. > > These opcodes actually date from very early versions of > Python, when locals were always ke

Re: From parsing a class to code object to class to mappingproxy to object (oh my!)

2019-04-05 Thread Gregory Ewing
adam.pre...@gmail.com wrote: Something I don't really understand from a code generation perspective is the switch over to STORE_NAME for class methods. That's because, in this particular situation, the locals are being kept in a dict instead of an array. When compiling an ordinary function, th

Re: From parsing a class to code object to class to mappingproxy to object (oh my!)

2019-04-04 Thread adam . preble
On Thursday, April 4, 2019 at 1:17:02 PM UTC-5, adam@gmail.com wrote: > Thanks for the response. I was meaning to write back earlier, but I've been > spending my free Python time in the evenings reimplementing what I'm doing to > work more correctly. I'm guessing before the code object repre

Re: From parsing a class to code object to class to mappingproxy to object (oh my!)

2019-04-04 Thread adam . preble
On Monday, April 1, 2019 at 1:23:42 AM UTC-5, Gregory Ewing wrote: > adam.pre...@gmail.com wrote: > https://eli.thegreenplace.net/2012/06/15/under-the-hood-of-python-class-definitions > > Briefly, it creates a dict to serve as the class's namespace dict, > then executes the class body function pas

Re: From parsing a class to code object to class to mappingproxy to object (oh my!)

2019-03-31 Thread Gregory Ewing
adam.pre...@gmail.com wrote: What is the plumbing taking the result of that code object over to this proxy? I'm assuming __build_class__ runs that code object and then starts looking for new names and see to create this. Is this mapping proxy the important thing for carrying the method declar