def degree(f, x=None):
        i = f.ring.index(x)

        if not f:
            return -oo
        else:
            return max([ monom[i] for monom in f.itermonoms() ])
The leading degree in ``x`` or the main variable.
dataset/ETHPy150Open sympy/sympy/sympy/polys/rings.py/PolyElement.degree