CopyPastor

Detecting plagiarism made easy.

Score: 0.7866725921630859; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2016-08-22
by Somnath Muluk

Original Post

Original - Posted on 2010-06-04
by Nas Banov



            
Present in both answers; Present only in the new answer; Present only in the old answer;

##[] and {} are better
list() is inherently slower than [] and dict() is inherently slower than {} ,
**Because**
1. There is symbol lookup (no way for python to know in advance if you did not just redefine list to be something else!),
2. There is function invocation,
3. Then it has to check if there was iterable argument passed (so it can create list with elements from it)
In most cases the speed difference won't make any practical difference though.
([source](https://stackoverflow.com/q/2972212))
`list()` is inherently slower than `[]`, because
1. there is symbol lookup (no way for python to know in advance if you did not just redefine list to be something else!),
2. there is function invocation,
3. then it has to check if there was iterable argument passed (so it can create list with elements from it) ps. none in our case but there is "if" check
In most cases the speed difference won't make any practical difference though.

        
Present in both answers; Present only in the new answer; Present only in the old answer;