On Mon, Mar 4, 2019 at 6:52 PM Stefan Behnel <stefan...@behnel.de> wrote: > > I think the main intentions is to close a gap in the language. > > [1,2,3] + [4,5,6] > > works for lists and tuples, > > {1,2,3} | {4,5,6} > > works for sets, but joining two dicts isn't simply > > {1:2, 3:4} + {5:6} >
Operators are syntax borrowed from math. * Operators are used for concatenate and repeat (Kleene star) in regular language. https://en.wikipedia.org/wiki/Regular_language seq + seq and seq * N are very similar to it, although Python used + instead of middle dot (not in ASCII) for concatenate. * set is directly relating to set in math. | is well known operator for union. * In case of merging dict, I don't know obvious background in math or computer science. So I feel it's very natural that dict don't have operator for merging. Isn't "for consistency with other types" a wrong consistency? > but requires either some obscure syntax or a statement instead of a simple > expression. > > The proposal is to enable the obvious syntax for something that should be > obvious. dict.update is obvious already. Why statement is not enough? Regards, _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/