[Python-Dev] (no subject)
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Feb 10 06:47:19 CET 2015
Donald Stufft wrote:
>
> why is:
>
> print(*[1], *[2], 3) better than print(*[1] + [2] + [3])?
It could potentially be a little more efficient by
eliminating the construction of an intermediate list.
> defining + or | or some other symbol for something similar
> to [1] + [2] but for dictionaries. This would mean that you could simply do:
>
> func(**dict1 | dict(y=1) | dict2)
Same again, multiple ** avoids construction of an
itermediate dict.
--
Greg
More information about the Python-Dev
mailing list