[Python-Dev] (no subject) (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Tue Feb 10 06:47:19 CET 2015
- Previous message: [Python-Dev] (no subject)
- Next message: [Python-Dev] (no subject)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Python-Dev] (no subject)
- Next message: [Python-Dev] (no subject)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]