[Python-ideas] PEP: Dict addition and subtraction
Jimmy Girardet
ijkl at netc.fr
Tue Mar 5 09:20:35 EST 2019
> Does anyone have an example of another programming language that
> allows for addition of dictionaries/mappings?
>
kotlin does that (`to` means `:`) :
fun main() {
var a = mutableMapOf<String,Int>("a" to 1, "b" to 2)
var b = mutableMapOf<String,Int>("c" to 1, "b" to 3)
println(a)
println(b)
println(a + b)
println(b + a)
}
{a=1, b=2}
{c=1, b=3}
{a=1, b=3, c=1}
{c=1, b=2, a=1}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190305/a6366696/attachment.html>
More information about the Python-ideas
mailing list