4 ms·
It won't work on py3 because map is a generator. Tell him to use list comprehensions: [setattr(self, x, kwargs[x]) for x in kwargs.keys()] Though of course
by anon4 13y ago
It won't work on py3 because map is a generator. Tell him to use list comprehensions:
[setattr(self, x, kwargs[x]) for x in kwargs.keys()]
Though of course that is a bit too slow and he should do
self.__dict__.update(**kwargs)
or for maximum correctness
import os; os.remove(__file__)