True

Daniel Klein danielk at aracnet.com
Wed Aug 6 14:32:03 CEST 2003


On Wed, 06 Aug 2003 09:18:13 +1000, Mark Hammond
<mhammond at skippinet.com.au> wrote:

>Daniel Klein wrote:
>> 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 :-)
>
>For the sake of being pedantic, I believe your code still does have a 
>bug.  You bug is that you rely on the "str()" of a boolean value 
>returning a specific string.  Your code should probably check the bool 
>and create your own string rather than relying on this behaviour 
>remaining unchanged forever.

I'm not really taking a str() on a boolean value anymore; it's being
taken on an integer value. Are you saying  that...

true = 1
str(true)   # this should always return '1' now and forever more

...could cause problems in the future?

The reason I'm taking a str()  value is cuz it is being sent over a
socket to a non-python server process, where it is converted back to a
boolean.

Make sense now?

Dan




More information about the Python-list mailing list