파이썬 Function call can be replaced with set literal 해결방법
파이썬에서 setTest 안에 set([1, 2, 3, 4])를 넣어주려고 하니 Function call can be replaced with set literal 이런 내용이 뜨는 것이 보인다 보면 에러는 아닌데 set 함수 쓰지말고 {} 쓰라는 얘기다 근데 왜? set 함수를 쓰지 않고 {}로 해결하는 것이 속도가 훨씬 빠르기 때문이다 테스트로 사용한 코드는 아래를 참조해주면 된다 import timeit setTest = set([1, 2, 3, 4]) print(timeit.timeit('setVariable = set([1, 2, 3, 4])')) print(timeit.timeit('setVariable2 = {1, 2, 3, 4}'))
2020. 1. 7.