collections.Counter()
항상 헷갈려
collections.Counter()를 쓸 때마다
collection에 s가 붙었는 지 안 붙었는 지,
c가 소문자였는 지 대문자였는 지 헷갈리고,
Counter 역시 마찬가지로 헷갈렸다.
그냥 많이 쓰다보면 외워지겠지..?라 생각했으나
나름 이유가 있다.
은 파이썬 코드를 작성할 때 따르면 좋은 스타일 가이드이다.
여러 내용이 있겠지만 변수명을 정하는 방법도 있다.
그 내용 중 일부를 살펴보자.
os, sys, math, random, collections, itertoolsCounter, OrderedDictdefaultdict은 소문자인데, 파이썬의 기본적인 자료형 list, dict, set이 소문자이고 이를 확장한 것이라 생각하면 된다.OrderedDict이랑 defaultdict을 보니 더 헷갈리는 것 같기도 하다.collections, itertoolsmath, json, timecollections.Counter()
이제 헷갈리지 않는다.