Message219867
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,
} |
|
Date |
User |
Action |
Args |
2014-06-06 10:17:45 | Pix | set | recipients:
+ Pix |
2014-06-06 10:17:45 | Pix | set | messageid: <1402049865.6.0.54047766444.issue21678@psf.upfronthosting.co.za> |
2014-06-06 10:17:45 | Pix | link | issue21678 messages |
2014-06-06 10:17:45 | Pix | create | |
|