EDIT: This does not work for the reasons stated in the comments. I will leave it here so that the next guy trying to answer does not do the same (until a real answer appears).
You should use type(self)
Example I simplified your code a bit, but the entity should still be there
def derived_generator(method): def new_method(self, *args, **kwargs): x = method(self, *args, **kwargs) y = getattr(super(type(self), self), method.__name__)\ (*args, **kwargs) for a, b in zip(y, x): yield a, b return new_method class BaseClass(object): def iterator(self): return [1, 2, 3] class ChildClass(BaseClass): @derived_generator def iterator(self): return [4, 5, 6] a = ChildClass() for x in a.iterator(): print(x)
greschd Oct 23 '14 at 22:08 2014-10-23 22:08
source share