True

Peter Hansen peter at engcorp.com
Wed Aug 6 12:18:45 EDT 2003


Daniel Klein wrote:
> 
> 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.

In that case, you'd be better off converting using your own routine
rather than relying on a particular behaviour of str() for this test.
Basically, do something like 

def boolean2String(boolVal):
  return { False : '1', True : '0' } [ not boolVal ]

and save yourself any further future pain...




More information about the Python-list mailing list