def once_per_instance(func):

    @functools.wraps(func)
    def wrapped(self, *args, **kwargs):
        if not hasattr(self, '__run_once_methods'):
            self.__run_once_methods = []

        name = func.__name__
        if name in self.__run_once_methods:
            log.debug('Method %s has already been called for %s... not calling again.' % (name, self))
            return False

        res = func(self, *args, **kwargs)

        self.__run_once_methods.append(name)
        return res

    return wrapped
Gets the number of items.
dataset/ETHPy150Open codekoala/django-articles/articles/decorators.py/once_per_instance--crossover with--dataset/ETHPy150Open dahlia/sider/sider/hash.py/Hash.__len__