[Python-ideas] Augmented assignment syntax for objects.

Carlo Miron miron at python.it
Wed Apr 26 08:16:09 EDT 2017


On Wed, Apr 26, 2017 at 2:02 PM,  <tritium-list at sdamon.com> wrote:

>> On Wed, Apr 26, 2017 at 01:12:14PM +0200, Brice PARENT
>> <contact at brice.xyz> wrote:
>> >     def _set_multiple(self, **kwargs):
>> >         for key, value in kwargs.items():
>> >             setattr(self, key, value)
>>
>>     self.__dict__.update(kwargs)
>
> Touching __dict__ feels dirty to me.

vars(self).update(kwargs)?

㎝

-- 
|:**THE 🍺-WARE LICENSE** *(Revision ㊷)*:
| <miron@🐍.it> wrote this mail. As long as you retain this
| notice you can do whatever you want with this stuff.
| If we meet some day, and you think this stuff is worth it,
| you can buy me a 🍺 in return. —㎝


More information about the Python-ideas mailing list