On 12/10/2011 3:47 PM, Roy Smith wrote:
What I really want to do is: def function(self):
Add a global statement to rebind a global name: global logger
logger = logger.getChild('function') logger.debug('stuff') logger.debug('other stuff') which lets me not have to change any lines of code other than inserting the one to redefine logger. Unfortunately, that's not legal Python (it leads to "UnboundLocalError: local variable 'logger' referenced before assignment"). Any ideas on the best way to implement this?
-- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list