[Python-ideas] True and False are singletons

David Mertz mertz at gnosis.cx
Mon Mar 18 17:47:17 EDT 2019


It was a VERY long time ago when True and False were not singletons. I
don't think we should still try to write code based on rules that stopped
applying more than a decade ago.

On Mon, Mar 18, 2019, 5:42 PM Greg Ewing <greg.ewing at canterbury.ac.nz>
wrote:

> 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
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190318/bb74851f/attachment-0001.html>


More information about the Python-ideas mailing list