0

I've heard that construction {} works much faster then dict(). But does that mean I have to write {} everywhere ?

faoxis
  • 1,912
  • 5
  • 16
  • 31
  • FWIW, `{}` is a literal so it can be created when the script is compiled to bytecode, whereas `dict()` calls the `dict` object constructor at runtime. Apart from efficiency considerations, it's generally considered better style to use a literal than an equivalent function / class call. – PM 2Ring Dec 07 '16 at 12:40

1 Answers1

0

Just use {} and [] and forget about dict() and list()

Andreas Rau
  • 338
  • 2
  • 11