True

Daniel Klein danielk at aracnet.com
Tue Aug 5 09:02:46 EDT 2003


On 04 Aug 2003 06:17:37 -0400, pinard at iro.umontreal.ca (François
Pinard) wrote:

>[Daniel Klein]
>
>> So my question is what is the proper method for setting booleans in 2.3?
>
>Hi, Daniel.
>
>In 2.3, you do not need to set booleans, `True' and `False' are just there.
>
>However, if you have a need to write portably against many versions, you
>might try something like:
>
>    try:
>        True
>    except NameError:
>        False, True = range(2)
>
>in modules where you need to use `True' or `False'.

Thanks François. I don't need to support multiple versions. I simply
changed the code from:

     true = (1 == 1)

to

     true = 1

and presto, no more bug :-)

Dan





More information about the Python-list mailing list