def __new__(cls, *args, **kwargs):
        args, kwargs = cls._process_args(*args, **kwargs)
        key = cls._cache_key(*args, **kwargs)

        def make_obj():
            obj = super(Cached, cls).__new__(cls)
            obj._key = key
            obj._initialized = False
            # obj.__init__ will be called twice when constructing
            # something not in the cache.  The first time here, with
            # the canonicalised args, the second time directly in the
            # subclass.  But that one should hit the cache and return
            # straight away.
            obj.__init__(*args, **kwargs)
            return obj

        # Don't bother looking in caches if we're not meant to cache
        # this object.
        if key is None:
            return make_obj()
        try:
            return cls._cache_lookup(key)
        except (KeyError, __HOLE__):
            obj = make_obj()
            cls._cache_store(key, obj)
            return obj
dataset/ETHPy150Open OP2/PyOP2/pyop2/caching.py/Cached.__new__