为什么collections.Counter大写而collections.defaultdict不是大写? [英] Why is collections.Counter uppercase and collections.defaultdict is not?
本文介绍了为什么collections.Counter大写而collections.defaultdict不是大写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
collections
模块中的某些元素似乎是大写的,而另一些则不是.其背后是否有具体的依据?
Some of the elements in the collections
module seem to be uppercase, some other not. Is there a specific rationale behind it?
推荐答案
According to this reddit comment
所有用python编写的类都是大写的驼峰字母.
All classes written in python are upper camel case.
所有基于C代码的类型都较低.[像原始图元]
All types based on C code are lower. [like the primitives]
namedtuple
是一个函数,因此遵循函数的命名约定. deque
和 defaultdict
是(C)类型; Counter
和 OrderedDict
是类(Python).
namedtuple
is a function, thus follows the naming convention of functions. deque
and defaultdict
are types, (C); Counter
and OrderedDict
are classes, (Python).
这篇关于为什么collections.Counter大写而collections.defaultdict不是大写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文