Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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__)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: