[Python-Dev] Silly pystones question

Skip Montanaro skip@pobox.com (Skip Montanaro)
Mon, 13 Aug 2001 09:59:34 -0500


    Tim> You're a developer, Skip: it's time you learned how to use CVS
    Tim> <wink>:

    Tim> <http://cvs.sf.net/cgi-bin/viewcvs.cgi/python/python/dist/src/Lib/test/pystone.py>

Thanks for the pointer to the CVS browsing stuff.  In my own defense, I
wrote that note while I was way offline in a rural cottage overlooking Lake
Michigan, so I couldn't run my usual "cvs annotate".  ;-)

    Tim> The evidence there says it's always been this way.

Thanks.

    Tim> Until The Rules change, any global (or builtin) is subject to
    Tim> rebinding at any time, even if there's no STORE_GLOBAL in sight.
    Tim> The "danger" across call sites is clear enough (a Python global is
    Tim> like a C extern), but in the presence of threads another thread can
    Tim> reach into the module and rebind its globals between any pair of
    Tim> byte codes (which C worms around via X3J11 refusing to say anthing
    Tim> at all about threads <0.9 wink>).

Yes, I understand this.  I was thinking (initially, at least) of only
applying such access optimizations in functions that themselves don't set
the global in question.  For example, in pystones, any references to the
various Proc* functions would be candidates for such optimizations.  This is
only to make my life easier.

The real thing here is that while I can "see" what I want with global
tracking, I'm a bit at a loss how to implement it cleanly.  I think what I
need to do at this point is write a PEP and solicit some feedback on
implementation possibilities.

Skip