There is a list
b = ['car', 'Nissan xTtrail', '4', 'f1.jpeg', '2.5'] Classes defined:
class CarBase: def __init__(self, car_type, brand, photo_file_name, carrying): self.car_type = car_type self.brand = brand self.photo_file_name = photo_file_name self.carrying = carrying` class Car(CarBase): def __init__(self, car_type, brand, passenger_seats_count, photo_file_name, carrying): super(Car, self).__init__(car_type, brand, photo_file_name, carrying) self.passenger_seats_count = passenger_seats_count` Tell me how to create an instance of the Car class using just the list b as attributes.
Those. if you call x = Car(b) , the interpreter will swear for the absence of the required brand arguments and so on.
Carorb. See. Is it possible to somehow simplify the initialization of classes in Python? - jfs