On Mon, Apr 16, 2012 at 5:34 AM, Daniel Urban firstname.lastname@example.org wrote:
On Sun, Apr 15, 2012 at 13:48, Nick Coghlan email@example.com wrote:
/me pages thoughts from 12 months ago back into brain...
Sorry about that, I planned to do this earlier...
No worries - good to have someone following up on it, since it had completely dropped off my own radar :)
No, I think we would want to expose the created namespace directly - that way people can use update(), direct assigment, exec(), eval(), or whatever other mechanism they choose to handle the task of populating the namespace. However, a potentially cleaner way to do that might be offer use an optional callback API rather than exposing a separate public prepare() function. Something like:
def build_class(name, bases=(), kwds=None, eval_body=None): metaclass, ns = _prepare(name, bases, kwds) if eval_body is not None: eval_body(ns) return metaclass(name, bases, ns)
That seems more flexible indeed. I will try to make a patch next week, if that's OK.
Sure, just create a new tracker issue and assign it to me. You already know better than most what the _prepare() step needs to do :)