Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

object is a class in python, but its first char is not capitalized

Tags:

python

I am learning Python these days (from Code Accademy). As I was working with the classes, they mentioned as a naming convention class name's first letter is capitalized.

but when I see the class declaration, they always use superclass "object". i.e. first character is not capital. Although its just a naming converntion, does it has any special meaning too?

is there anything am missing?

like image 319
Jasmeet Avatar asked Mar 10 '26 11:03

Jasmeet


1 Answers

PEP8 suggests to use CapWords (or PascalCase) convention for class names, but it is mentioned that builtins follow a different convention:

Note that there is a separate convention for builtin names: most builtin names are single words (or two words run together), with the CapWords convention used only for exception names and builtin constants.

I should mention that PEP8 uses different names for naming styles than most of us (MSDN, Wikipedia):

common naming     pep8 naming
-------------     -----------
PascalCase        CapitalizedWords, CapWords, CamelCase
camelCase         mixedCase
like image 76
Tamas Hegedus Avatar answered Mar 12 '26 02:03

Tamas Hegedus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!