Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

capitalization of library class names

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

Is there some subtle difference that I should be aware of?

(P3K)

like image 750
max Avatar asked Oct 27 '10 12:10

max


2 Answers

The capitalization of the class names is irrelevant, it doesn't signify anything. Except that Python has sometimes grown organically and the standard library doesn't have the same homogenous feel as other large libraries such as the Win32 API or the Java standard library.

like image 160
Ned Batchelder Avatar answered Oct 05 '22 10:10

Ned Batchelder


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/

like image 45
Stefano Palazzo Avatar answered Oct 05 '22 08:10

Stefano Palazzo