class NeedsChildren(object): """Decorator you use to specify whether a subclass method requires this TreeObject to renumerate the childen. This is done so the children of a given tree object may be lazily evaluated. """ def __init__(self, f): self.__f = f def __call__(self, *args, **kwargs): args[0].need_children() return self.__f(*args, **kwargs)