Gabriel Genellina wrote: > En Wed, 28 Jan 2009 01:36:57 -0200, Steve Holden <st...@holdenweb.com> > escribió: >> Gabriel Genellina wrote: >>> En Tue, 27 Jan 2009 22:17:16 -0200, Robert Kern <robert.k...@gmail.com> >>> escribió: > >>> I *thought* I did understand this until I came to this example: >>> >>> 1) >>>>>> id(globals()), id(locals()) >>> (11239760, 11239760) >>> >>> # ok, globals and locals are the same at the module level >>> >>> 2) >>>>>> s = "(id(n) for n in [globals(),locals()])" >>>>>> list(eval(s)) >>> [11239760, 11239760] # still the same results >>> >>> 3) >>>>>> s = "(id(n()) for n in [globals,locals])" >>>>>> list(eval(s)) >>> [11239760, 12583248] # locals() is different >>> >> No, locals is different, not locals(). You are looking at two different >> functions that return the same object when called in the given context, >> that's all. > > Perhaps you didn't notice that I shifted the () from right to left. I'm > always printing the result of *calling* globals and locals -- the only > change is *where* I do call them. > Ah, right. As you were ...
regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- http://mail.python.org/mailman/listinfo/python-list