title: Pythonic Boolean Conversion
body: <p>I'm writing a module to act on data being sent to a database from Python.  Since boolean is not a SQL datatype, those values have to be converted to some pre-defined value.  I decided while defining the tables that I would use 'T' and 'F' in a varchar(1) field as my Boolean stand in.</p>
  
  <p>In attempting to make this conversion while being properly Pythonic, I did a direct comparison and acted on the results, as so:</p>
  
  <pre><code>        if SQLParameters[i] == True:
              SQLParameters[i] = 'T'                
          elif SQLParameters[i] == False:
              SQLParameters[i] = 'F'
  </code></pre>
  
  <p>This is on code that runs regardless of type, so if <code>SQLParameters[i]</code> is 1 or "Blarg" or 123, I just want to leave it alone, whereas when it's a Boolean, I need to perform the conversion.</p>
  
  <p>This worked just fine until I tried to insert the actual value 1 (one), at which point I learned that <code>1 == True = True</code>.  I can plainly see two possible solutions for this issue: </p>
  
  <ol>
  <li>change the data dictionary to use 0 and 1 in a number(1) field as the Boolean stand-in, making the conversion simpler </li>
  <li>add a condition to the code above to check the actual type of the parameter to be converted (which strikes me as unpythonic).</li>
  </ol>
  
  <p>Does anyone have an idea about how to accomplish this without either changing the data dictionary or explicitly checking the type?</p>