[Python-ideas] True and False are singletons
Oleg Broytman
phd at phdru.name
Mon Mar 18 08:08:22 EDT 2019
On Tue, Mar 19, 2019 at 12:27:04AM +1300, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Juancarlo A?ez wrote:
>
> > if settings[MY_KEY] is True:
> > ...
>
> If I saw code like this, it would take a really good argument to
> convince me that it shouldn't be just
>
> if settings[MY_KEY]:
> ...
Three-way (tri state) checkbox. You have to distinguish False and
None if the possible valuse are None, False and True.
> --
> Greg
Oleg.
--
Oleg Broytman https://phdru.name/ phd at phdru.name
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-ideas
mailing list