Цепочка конструкторов

Классы / Конструкторы

# One __init__ per class: other ways
# to build go through class methods


class Man:
    def __init__(self, name, country):
        self.name = name
        self.country = country

    @classmethod
    def from_name(cls, name):
        return cls(name, "unknown")


man1 = Man("Vladimir", "Russia")
man2 = Man.from_name("Vladimir")
# man2.country is 'unknown'

print(f"{man1.country = }")
print(f"{man2.country = }")