Yes, that's the sort of thing I had in mind, although it hadn't occurred to me that it would be as simple as this. To satisfy the original use case, it would need the module the name is defined in passed to __def__ as well. One other possibility would be passing the containing class, too, but I don't think that's needed - the metaclass machinery gives us the means to play class-based tricks already.