capitalization of library class names

前端 未结 3 1396
生来不讨喜
生来不讨喜 2021-01-19 21:50

Why do collection.defaultdict and collection.OrderedDict have different capitalizations?

Is there some subtle difference that I should be a

3条回答
  •  别那么骄傲
    2021-01-19 22:50

    Usually, that is in accordance with good style, classes are capitalised.

    def MyClass (object):
        pass
    
    my_instance = MyClass()
    

    like this.

    You should read this document about it: http://www.python.org/dev/peps/pep-0008/

提交回复
热议问题