@staticmethod decorator

https://docs.python.org/3/library/functions.html

INTRODUCTION

The @staticmethod decorator transforms a method into a static method. A static method does not receive an implicit first argument (self).


# Syntax.

class C:
    @staticmethod
    def f(arg1, arg2, ...):   # no 'self'
        statements

# Calling: C.f() or C().f()

def regular_function(argument_list):
    statements

class C:
    method = staticmethod(regular_function)

POLYNOMIALS


class Poly:

    def __init__(self, c=0, n=0):
        self.data = (n+1) * [0]
        self.data[-1] = c

    @staticmethod
    def gcd(a, b):
        if a % b == 0:
            return b
        else:
            return Poly.gcd(b, a % b)

assert Poly.gcd(3, 5) == 1
assert Poly.gcd(4, 6) == 2