True

Andrew Dalke adalke at mindspring.com
Mon Aug 4 00:32:17 EDT 2003


Daniel Klein:
> > true = (1 == 1)
> > false = not true
> >
> > This was at the recommendation of someone on this list some time ago.

John Roth
> There were no true booleans in 2.2 and earlier. Whoever recommended
> that didn't know what he was talking about. There was no difference.

Indeed, there were no true booleans in Python, but there were
actual PyTrue and PyFalse objects at the C level.  Doing the "1 == 1"
trick would expose that implementation choice to Python.

This was rarely used.  The only place I know of is in the win32 code,
where a COM API can take a boolean or an integer function.  The
win32 interface checks if the value is PyTrue/PyFalse,

Here's relevant links
http://mail.python.org/pipermail/python-list/1999-November/015260.html
http://mailman.pythonpros.com/pipermail/pycom-dev/1999q1/000106.html

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list