def METHOD_NAME(self):
    """
    Return the rank of ``self`` which for type `X_n` is `n`.
    EXAMPLES::
        sage: CartanType(['A', NN]).rank()
        +Infinity
        sage: CartanType(['A', ZZ]).rank()
        +Infinity
    As this example shows, the rank is slightly ambiguous because the root
    systems of type `['A',NN]` and type `['A',ZZ]` have the same rank.
    Instead, it is better ot use :meth:`index_set` to differentiate between
    these two root systems.
    """
    return self.n.cardinality()