On Jul 2, 1:25 am, Terry Reedy <tjre...@udel.edu> wrote: > > The next statement works, > > but I'm not sure if it will have any dramatical side effects, > > other than overruling a possible object with the name A > > > def some_function ( ...) : > > A = object ( ...) > > sys._getframe(1).f_globals [ Name ] = A > > global name > name = A > > or is name is a string var > globals()[name] = A
It wasn't explicit, but I think Stef meant that the global should be added to the caller's environment, which was the reason for sys._getframe(). Is this environment only intended for interactive use? I wonder if you might just set things up in a PYTHONSTARTUP script instead. -- http://mail.python.org/mailman/listinfo/python-list