This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Pix
Recipients Pix
Date 2014-06-06.10:17:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1402049865.6.0.54047766444.issue21678@psf.upfronthosting.co.za>
In-reply-to
Content
First of all, i'm sorry for my English :)

I would like to union dictionaries with operator + (and +=) like this:

>>> dict(a=1, b=2) + {'a': 10, 'c': 30}
{'a': 10, 'b': 2, 'c': 30}

>>> d = dict(a=1, b=2, c={'c1': 3, 'c2': 4})
>>> d += dict(a=10, c={'c1':30})
>>> d
{'a': 10, 'b': 2, c: {'c1':30}}


Also, it gives an easy way to modify and extend the class attributes:

class Super:
   params = {
       'name': 'John',
       'surname': 'Doe',
   }

class Sub(Super):
   params = Super.params + {
       'surname': 'Show',
       'age': 32,
   }
History
Date User Action Args
2014-06-06 10:17:45Pixsetrecipients: + Pix
2014-06-06 10:17:45Pixsetmessageid: <1402049865.6.0.54047766444.issue21678@psf.upfronthosting.co.za>
2014-06-06 10:17:45Pixlinkissue21678 messages
2014-06-06 10:17:45Pixcreate