[Python-Dev] Accessing globals without dict lookup (original) (raw)

Ka-Ping Yee ping@lfw.org
Mon, 11 Feb 2002 07:22:27 -0600 (CST)


On Mon, 11 Feb 2002, Ka-Ping Yee wrote:

This simplifies things further:

PyObject* cellget(PyGlobalCell* c) { return c->cellcellptr->cellobjptr; }

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?

-- ?!ng