I like to know, which is the best practice to declare dictionary in below 2 approaches and why?
>>>a=dict(one=2, two=3) # {"two":3, "one":2}
>>>a={"two":3, "one":2}
Would you believe someone has already analyzed that (from a performance perspective).
With CPython 2.7, using dict() to create dictionaries takes up to 6 times longer and involves more memory allocation operations than the literal syntax. Use {} to create dictionaries, especially if you are pre-populating them, unless the literal syntax does not work for your case.
betterinstead of closing. - Mahori