gpt4 book ai didi

python - 为什么collections.Counter是大写而collections.defaultdict不是?

转载 作者:太空宇宙 更新时间:2023-11-03 17:16:23 24 4
gpt4 key购买 nike

collections 模块中的某些元素似乎是大写的,而另一些则不是。其背后有具体的理由吗?

最佳答案

根据this Reddit 评论

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 and defaultdict are types, (C); Counter and OrderedDict are classes, (Python).

关于python - 为什么collections.Counter是大写而collections.defaultdict不是?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33636940/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com