[issue21678] Add operation plus for dictionaries
New submission from Михаил Мишакин: 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, } -- components: Interpreter Core messages: 219867 nosy: Pix priority: normal severity: normal status: open title: Add operation plus for dictionaries versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21678 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21678] Add operation plus for dictionaries
Михаил Мишакин added the comment: Is's like list's operation + and it's method list.extend(). But dict have no operation +... If I have two lists (A and B), and I want to get third list (not change A and B) i do this: C = A + B If I have two dicts, i can do this: C = dict(A, **B) But if i have three dictionaries, code becomes this: C = dict(A, **dict(B, **D)) Don't you think, that + is more comfortable? A = [1, 2, 3] B = [4, 5] C = [6, 7] A + B + C = [1,2,3,4,5,6,7] I can do this with list, tuples and strings. Why i can't do this with dictionaries? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21678 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21171] Outdated usage str.encode('rot-13') in rot13 codec
New submission from Михаил Мишакин: Function rot13 in file encodings/rot_13.py throws exception: LookupError: 'rot-13' is not a text encoding; use codecs.encode() to handle arbitrary codecs -- messages: 215712 nosy: Pix priority: normal severity: normal status: open title: Outdated usage str.encode('rot-13') in rot13 codec type: enhancement versions: Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21171 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21171] Outdated usage str.encode('rot-13') in rot13 codec
Changes by Михаил Мишакин pixzi...@gmail.com: -- components: +Library (Lib) ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21171 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com