Some of the elements in the collections
module seem to be uppercase, some other not. Is there a specific rationale behind it?
Why is collections.Counter uppercase and collections.defaultdict is not?
Asked Answered
According to this reddit comment
All classes written in python are upper camel case.
All types based on C code are lower. [like the primitives]
namedtuple
is a function, thus follows the naming convention of functions.deque
anddefaultdict
are types, (C);Counter
andOrderedDict
are classes, (Python).
© 2022 - 2024 — McMap. All rights reserved.
counter
(which would shadow that name)? Anddefaultdict
? – Margaretamargarete