Last active
November 21, 2019 04:22
-
-
Save y56/c22e1f99d1991f8144e050af06195457 to your computer and use it in GitHub Desktop.
What's the difference between dict() and {}?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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