Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the history behind capitalization of None, True and False in Python? [duplicate]

Tags:

python

pep8

Python has some of the value-like objects capitalized: True, False, None.

>>> type(True)
<type 'bool'>
>>> type(None)
<type 'NoneType'>
>>>

As the current PEP-8 style guide recommends writing instances and variable names in lowercase, what is the history behind writing these value-like objects capitalized?

As it is answered / commented that built-ins are capitalized, but what is the rationale and inspiration behind this? In most languages built-ins are all uppercase, so one would expect Python to follow this paradigm?

like image 684
Mikko Ohtamaa Avatar asked Dec 28 '13 23:12

Mikko Ohtamaa


1 Answers

The goal of Python is consistency within itself, not consistency to other languages. True and False are capitalized because most, if not all, built in constants are capitalized. While I am not aware of exactly why it is done, it is probably because it is easier to differentiate them from variables when the first letter is capitalized, as if it is lowercase, it is easy to confuse it with a variable.

like image 144
SevenBits Avatar answered Oct 07 '22 03:10

SevenBits