All members are camel case, right? Why True/False but not true/false, which is more relaxed?
-
All members are camel case, right? No, it depends. Use **snake_case** to declare variables, functions, modules and packages (ex: first_name, calculate_sum). For Constants, use all uppercase and separate words by underscore if needed (ex: HEADING_COLOR). For classes, use **PascalCase** (ex: StudentRecords) – Akshay Katiha Jul 09 '23 at 09:02
4 Answers
From Pep 285:
Should the constants be called 'True' and 'False' (similar to None) or 'true' and 'false' (as in C++, Java and C99)?
=> True and False.
Most reviewers agree that consistency within Python is more important than consistency with other languages.
This, as Andrew points out, is probably because all (most)? built-in constants are capitalized.

- 370,779
- 53
- 539
- 685

- 31,389
- 11
- 53
- 57
-
Thanks James, but isn't the default casing is camel casing in python? – Joan Venge Feb 06 '09 at 18:21
-
3It is for classes. There are different rules for other things. Scroll to "Naming Conventions": http://www.python.org/dev/peps/pep-0008/ – Baltimark Feb 06 '09 at 19:49
-
11
-
20the real question is: Why is 'None' capitalized in the first place? I get errors again and again because I write a constant in lowercase... – xeruf May 17 '17 at 16:44
All of python's built-in constants are capitalized or [upper] CamelCase:

- 26,554
- 4
- 50
- 59
-
2
-
4@Kev, yes, but technically, I think "upper CamelCase" is the same as PascalCase. – Andrew Jaffe Feb 06 '09 at 19:57
Here's a possible explaination:
I see that naming conventions are such that classes usually get named CamelCase. So why are the built-in types named all lowercase (like list, dict, set, bool, etc.)?
Because most of them originally were types and factory functions, not
classes - and a naming convention is not a strong reason to make backwards incompatible changes. A different example: the new builtin typeset
is based on (altough not exactly equal to) the Set class from the sets module

- 4,176
- 2
- 24
- 29
In python only the 3 keywords True ,False and None are started with capital letters. I think This is to differentiate these 3 keywords from others. These 3 keywords can be used as literals or values where as other keywords not. For example
a=True is correct but a=for is wrong

- 1
- 2