Test 0 and false since false is 0

Rhodri James rhodri at kynesim.co.uk
Wed Jul 12 07:35:06 EDT 2017


On 12/07/17 03:29, Stefan Ram wrote:
> Grant Edwards <grant.b.edwards at gmail.com> writes:
>> False is required to be a singleton.
> 
>    »singleton« usually means »the sole object of its class«.
> 
>        »Ensure a class only has one instance, and provide a
>        global point of access to it.« - Gamma et al.

We are using the term differently.  We are vast, we contain multitudes, 
etc, etc.

>>>> type( False )
> <class 'bool'>
> 
>>>> type( True )
> <class 'bool'>
> 
>    It seems, »False« is not a singleton under the
>    implementation of Python I used.

The point that was being made is that there are no other bools than True 
and False, and they are distinct from the objects 1 and 0.

-- 
Rhodri James *-* Kynesim Ltd



More information about the Python-list mailing list