@richard Вы можете использовать библиотеку copy для копирования класса.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
import copy class http: def __init__(self, http_client_version : int): self.http_client_version = http_client_version def connect(self, host : str, port : int): self.make_connection(host = host, port = port) ... http_copy = copy.copy(http) # Создаем поверхностную копию http_deepcopy = copy.deepcopy(http_copy) # Создаем "глубокую" копию |