Python slang
Chris Angelico
rosuav at gmail.com
Fri Aug 5 22:10:46 EDT 2016
On Sat, Aug 6, 2016 at 11:55 AM, Steven D'Aprano
<steve+python at pearwood.info> wrote:
>>> * `True`, `False` and None instead of `true`, `false` and `none` (they
>>> seems classes)
>>
>> This one, I've no idea about. Why have "bool" as the type, and "True"
>> and "False" as the instances? I think the built-in types have their
>> names grandfathered in from when they were factory functions, but that
>> doesn't explain the capitalized instances. (And the type of None is
>> NoneType, just to confuse the matter further.)
>
> Read the PEP:
>
> https://www.python.org/dev/peps/pep-0285/
>
> 3) 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.
>
That answers the question about True and False, but not about None,
which started the question. Why are instances capitalized here? Is it
simply a matter of grandfathering in, with no specific decision?
ChrisA
More information about the Python-list
mailing list