Why True/False is capitalized in Python?
Why True/False is capitalized in Python?
--
Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Lost Jungle Looping
--
Chapters
00:00 Question
00:21 Accepted answer (Score 85)
01:05 Answer 2 (Score 17)
01:20 Answer 3 (Score 5)
02:05 Answer 4 (Score -3)
02:35 Thank you
--
Full question
https://stackoverflow.com/questions/5214...
Accepted answer links:
[Pep 285]: http://www.python.org/dev/peps/pep-0285/
[all (most)? built-in constants are capitalized]: http://docs.python.org/library/constants...
Answer 2 links:
[built-in constants]: http://docs.python.org/library/constants...
Answer 3 links:
[possible explaination]: http://mail.python.org/pipermail/python-...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #camelcasing
#avk47
ACCEPTED ANSWER
Score 89
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.
ANSWER 2
Score 18
All of python's built-in constants are capitalized or [upper] CamelCase:
ANSWER 3
Score 6
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 typesetis based on (altough not exactly equal to) the Set class from the sets module