def transpose(self, *dims):
    """ Permute dimensions
    
    Analogous to numpy, but also allows axis names

    Parameters
    ----------
    *dims : int or str
        variable list of dimensions

    Returns
    -------
    transposed_array : DimArray

    See also
    ---------
    reshape, flatten, unflatten, newaxis

    Examples
    --------
    >>> import dimarray as da
    >>> a = da.DimArray(np.zeros((2,3)), ['x0','x1'])
    >>> a          
    dimarray: 6 non-null elements (0 null)
    0 / x0 (2): 0 to 1
    1 / x1 (3): 0 to 2
    array([[0., 0., 0.],
           [0., 0., 0.]])
    >>> a.T       
    dimarray: 6 non-null elements (0 null)
    0 / x1 (3): 0 to 2
    1 / x0 (2): 0 to 1
    array([[0., 0.],
           [0., 0.],
           [0., 0.]])
    >>> (a.T == a.transpose(1,0)).all() and (a.T == a.transpose('x1','x0')).all()
    True
    """
    if len(dims) == 1 and type(dims[0]) in (list, tuple, set):
        dims = dims[0]

    if len(dims) == 0:
        if self.ndim == 2:
            dims = [1,0] # numpy, 2-D case
        elif self.ndim == 1:
            dims = [0]
        elif self.ndim == 0:
            return self
        else:
            raise ValueError("indicate dimensions to transpose")

    # get equivalent indices 
    newshape, _ = self._get_axes_info(dims)

    result = self.values.transpose(newshape)
    newaxes = [self.axes[i] for i in newshape]
    return self._constructor(result, newaxes, **self.attrs)