[Python-Dev] Accessing globals without dict lookup
Mon, 11 Feb 2002 07:22:27 -0600 (CST)
On Mon, 11 Feb 2002, Ka-Ping Yee wrote:
> This simplifies things further:
> PyObject* cell_get(PyGlobalCell* c)
> return c->cell_cellptr->cell_objptr;
I forgot to mention that this would also add loopback cellptrs for
the two cells pointed to by __builtin__.abs and __builtin__.max.
But hey... in that case the cellptr is always two steps away from
the object. So why not just use PyObject**s instead of cells?
dict -> ptr -> ptr -> object
(Or, if we want to maintain backward compatibility with existing
dictionaries, let a cell be an object, so we can check its type,
and have it contain just one pointer instead of two?)
Am i out to lunch?