[Python-Dev] Accessing globals without dict lookup

Skip Montanaro skip@pobox.com
Sun, 10 Feb 2002 15:39:28 -0600


    >> When a function object is created from a regular dict instead of a
    >> celldict, func_cells is a NULL pointer.

    Tim> This part is regrettable, since it's Yet Another NULL check at the
    Tim> *top* of code using this stuff (meaning it slows the normal case,
    Tim> assuming that it's unusual not to get a celldict).  I'm not clear
    Tim> on how code ends up getting created from a regular dict instead of
    Tim> a celldict -- is this because of stuff like "exec whatever in
    Tim> mydict"?

I'm still working my way through this thread, so forgive me if this has been
hashed out already.  It seems to me that the correct thing to do is to
convert plain dicts to celldicts when creating functions.  Besides, where
are functions going to get created that are outside of your (PyhonLabs)
control?

Skip