Constantly checking existence of dictionary elements in Python: a better way? I use Python dictionaries to count words in a corpus:

words[a] = number of times I saw a in the corpus.

Every time before incrementing a counter (words[a] += 1), I need to check a condition: 
does the dictionary entry words[a] actually exists?

My code:

    if a in words:
      words[a] += 1
    else:
      words[a] = 1


It there a way to improve it?
For Python >= 2.5 you can use defaultdict instead of dict:

 from collections import defaultdict
 words = defaultdict(int)
 corpus = ["your", "word", "corpus"]
 for a in corpus:
    words[a]+=1
 print words


For Python >= 2.7 you can use Counter:

from collections import Counter
corpus = ["your", "word", "corpus"]
words = Counter(corpus)
print words