Skip to content

Instantly share code, notes, and snippets.

@y56
Last active November 21, 2019 04:22
Show Gist options
  • Save y56/c22e1f99d1991f8144e050af06195457 to your computer and use it in GitHub Desktop.
Save y56/c22e1f99d1991f8144e050af06195457 to your computer and use it in GitHub Desktop.
What's the difference between dict() and {}?
https://stackoverflow.com/questions/664118/whats-the-difference-between-dict-and
>>> from timeit import timeit
>>> timeit("a = {'a': 1, 'b': 2}")
0.424...
>>> timeit("a = dict(a = 1, b = 2)")
0.889...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment