On Tue, Aug 2, 2016 at 1:45 AM, Lawrence D’Oliveiro <lawrenced...@gmail.com> wrote: > On Friday, July 29, 2016 at 6:25:51 AM UTC+12, Enjoys Math wrote: > >> exec('obj = ' + objType + '(self)', None, _locals) >> obj = _locals['obj'] > > Why? Why not just > > obj = objType(self)
I think you meant to use `globals()[objType](self)`, as was already suggested by Chris Angelico. The value of objType appears to be the type's name, maybe from marshaled data. -- https://mail.python.org/mailman/listinfo/python-list