Skip to main content
1 of 4
Joran Beasley
  • 112.9k
  • 13
  • 164
  • 184

explicit is better than implicit ... so sure you could do a one liner

for k,v in locals().items(): setattr(self,k,v)

the better question is should you ...

... that said if you want a named tuple I would recommend using a namedtuple (remember tuples have certain conditions attached to them) ... perhaps you want an ordereddict or even just a dict ...

Joran Beasley
  • 112.9k
  • 13
  • 164
  • 184