def create_instance(self, carname): ''' look for the carname in the autos dictionary If it finds one it will return it, else it will create and instance of the nullcar ''' if carname in self.autos: return self.autos[carname]() else: return autos.NullCar(carname)
def create_instance(self, carname): if carname in self._autos: return self._autos[carname]() else: return autos.NullCar(carname)