Martin> The namespace issue alluded to doesn't exist when using the very Martin> similar approach suggested earlier in this thread by Andrew Martin> Durdin
Sure, but I don't think I want to pay the cost of the exec statement. if/else would probably be quicker. -- shown again below in a [very] contrived example Martin> illustrating access to the local namespace: Martin> greeting = "Hello there, " Martin> x = 2 Martin> exec { Martin> 1: """greeting += 'Tom'""", Martin> 2: """greeting += 'Dick'""", Martin> 3: """greeting += 'Harry'""", Martin> }.get(x, """greeting += 'Unknown'""") Martin> print greeting Martin> Martin Martin> -- Martin> http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list