Setting boolean COM properties
Mark Hammond
MarkH at ActiveState.com
Tue Feb 13 02:37:11 EST 2001
Wiwih Gunadi wrote:
> Does anybody know how to set a boolean COM object property?
> In his book, Mark indicated two objects PyTrue and PyFalse but he didn't
> tell how to get these objects.
>
> Searching the internet yields dissapointing results leading me to believe
> that these objects are obsolete or nobody ever use'em.
You can just use integers 1 and 0, and they should work fine.
PyTrue and PyFalse are hidden objects. You can get at them via:
true = 1==1
false = 1==0
Due to a quirk in Python, these variables will then look like ints, but
are really the PyTrue and PyFalse objects, as shown here:
>>> true = 1==1
>>> true
1
>>> true == 1
1
>>> true is 1
0
>>>
HTH,
Mark.
More information about the Python-list
mailing list