from timeit import timeit

class Point:

    def __init__(self, x, y):
        self.x = x
        self.y = y


class PointSlots:

    # Теперь __dict__ не будет и нельзя будет создавать новые атрибуты.
    __slots__ = {'x', 'y'}

    def __init__(self, x, y):
        self.x = x
        self.y = y

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

class Person:

    __slots__ = {'first_name', 'last_name', 'age'}

    def __init__(self, first_name, last_name, age):
        self.first_name = first_name
        self.last_name = last_name
        self.age = age

    def __str__(self):
        return f"{self.first_name} {self.last_name} is {self.age} years old"


def make_cl1():
    s = Point(3, 4)
    s.x = 100
    s.x
    del s.x

def make_cl2():
    s = PointSlots(3, 4)
    s.x = 100
    s.x
    del s.x




def main():
    print(timeit(make_cl1))
    print(timeit(make_cl2))


if __name__ == '__main__':
    main()