Is there any significance to the capitalization practices for classes in the collections
module in Python? In particular, I find it puzzling that OrderedDict
uses CamelCase while defaultdict
is all lowercase. My assumption would be they would all use CamelCase since they are all classes.
The naming is historical (for CPython). Originally, CamelCase classes (like OrderedDict
) were pure python implemented and other classes (like defaultdict
) were C-implemented. However, now the names are just legacy (mostly), since C-implementation has often been added (e.g. here for OrderedDict
- you can see now that the python implementation is only a fallback).