On Mon, Mar 28, 2011 at 1:29 PM, Laura Creighton <l...@openend.se> wrote:
> In a message of Mon, 28 Mar 2011 11:19:45 PDT, kirby urner writes: > >--===============0915739999== > >Content-Type: multipart/alternative; boundary=20cf303b3f9bfa4ea5049f8efcd > > >What I less understand is why g isn't just a *snap shot* of what was > global > >at the time globals( ) ran. > > Because you didn't bind g to a copy of the global dictionary at time t. > You bound it to the global dictionary itself. > > Laura > Yes, and the contents of that dict change as a side effect of assignment in the global namespace. When I bind to dir( ) at time t, there's no mutating dict on the other end of the line, just a snap shot. >>> ================================ RESTART ================================ >>> d = dir() >>> d ['__builtins__', '__doc__', '__name__', '__package__'] >>> v = 14 >>> d ['__builtins__', '__doc__', '__name__', '__package__'] >>> dir() ['__builtins__', '__doc__', '__name__', '__package__', 'd', 'v'] Kirby
_______________________________________________ Edu-sig mailing list Edu-sig@python.org http://mail.python.org/mailman/listinfo/edu-sig