[Python-ideas] True and False are singletons

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Mar 18 16:58:55 EDT 2019


Oleg Broytman wrote:
>    Three-way (tri state) checkbox. You have to distinguish False and
> None if the possible valuse are None, False and True.

In that case the conventional way to write it would be

     if settings[MY_KEY] == True:
         ...

It's not a major issue, but I get nervous when I see code
that assumes True and False are unique, because things
weren't always that way.

-- 
Greg


More information about the Python-ideas mailing list