On 2017-04-26 04:12, Brice PARENT wrote:
Why not simply do this :
class MyClass:
def _set_multiple(self, **kwargs):
for key, value in kwargs.items():
setattr(self, key, value)
def __init__(self, a, b, c):
self._set_multiple(a=a, b=b, c=c)
If the goal is to not have to type out argument names three times (in DRY
fashion), this doesn't quite fit the bill.
-Mike
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/