[Python-Dev] Accessing globals without dict lookup

Jeremy Hylton jeremy@alum.mit.edu
Sat, 9 Feb 2002 23:21:01 -0500


>>>>> "JH" == Jeremy Hylton <jeremy@alum.mit.edu> writes:

  JH> Case #1: Binding operation responsible for invalidating cache.

  JH> The module has a dlict for globals that contains three entries:
  JH> [math, mysin, yikes].  Each is a PyObject *.

  JH> The module also has a global attrs cache, where each entry is
  JH> struct {
  JH>     int ce_initialized; /* just a flag */ PyObject **ce_ref;
  JH> } cache_entry;

  JH> In the case we're considering, ce_module points to math and
  JH> ce_module_index is math's index in the globals dlict.  It's
  JH> assigned to when the module object is created and never changes.

Just pretend I didn't write this paragraph :-(.  I was going to
describe the other case first, then changed my mind.  The previous
paragraph describes Case #2.  

The text before and after this paragraph looks clear to me.  Does
anyone else agree?  I didn't think I had done any hand waving on
globals and module attributes in the slides; so I expect that I'm not
a good judge of what is hand waving and what is high-level
description.

Jeremy