def __getitem__(self, i):
        """
        Example:
            >>> dist = chaospy.J(chaospy.Uniform(), chaospy.Normal())
            >>> print(dist[0])
            Uniform(lower=0, upper=1)
            >>> print(dist[1])
            Normal(mu=0, sigma=1)
            >>> print(dist[:1])
            J(Uniform(lower=0, upper=1))
            >>> print(dist[:2])
            J(Uniform(lower=0, upper=1), Normal(mu=0, sigma=1))
            >>> print(dist[2])
            Traceback (most recent call last):
                ...
            IndexError: index out of bounds.
        """
        if isinstance(i, int):
            i = "_%03d" % i
            if i in self.prm:
                return self.prm[i]
            raise IndexError("index out of bounds.")
        if isinstance(i, slice):
            start, stop, step = i.start, i.stop, i.step
            if start is None: start = 0
            if stop is None: stop = len(self)
            if step is None: step = 1
            out = []
            prm = self.prm
            for i in range(start, stop, step):
                out.append(prm["_%03d" % i])
            return J(*out)
        raise IndexError("index not recognised.")
def __getitem__ ( self , i ) : if isinstance ( i , int ) : i = "_%03d" % i if i in self . prm : return self . prm [ i ] raise IndexError ( "index out of bounds." ) if isinstance ( i , slice ) : start , stop , step = i . start , i . stop , i . step if start is None : start = 0 if stop is None : stop = len ( self ) if step is None : step = 1 out = [ ] prm = self . prm for i in range ( start , stop , step ) : out . append ( prm [ "_%03d" % i ] ) return J ( * out ) raise IndexError ( "index not recognised." )
Example:
            >>> dist = chaospy.J(chaospy.Uniform(), chaospy.Normal())
            >>> print(dist[0])
            Uniform(lower=0, upper=1)
            >>> print(dist[1])
            Normal(mu=0, sigma=1)
            >>> print(dist[:1])
            J(Uniform(lower=0, upper=1))
            >>> print(dist[:2])
            J(Uniform(lower=0, upper=1), Normal(mu=0, sigma=1))
            >>> print(dist[2])
            Traceback (most recent call last):
                ...
            IndexError: index out of bounds.