title: How to link variables so that they cannot both be true or both be false etc.?
body: <p>Not sure if my question title is correct, please tell me if it isn't so.</p>
  
  <p>Say I have a list, dictionary or tuple of transactions, where the transactions are instances of class. I want to record whether the transaction is pending, completed or cancelled, so I create booleans (within the __init__() of the class) self.completed and self.cancelled (whether it is pending or not can be inferred from both self.completed and self.cancelled being False)</p>
  
  <p>Of course, a transaction cannot be any more than one of the three states at any time, so is there any library to check that only one is true at a time?</p>
  
  <p>I could check this every time I change one of the variables and raise an exception, but I would rather save the lines of code.</p>
  
  <p>I could also have a variable with a integer value of 0, 1, or 2; where 0 is pending, 1 is completed etc. However, this gets rid of the intuitive:</p>
  
  <pre><code>    if transaction_a.completed == True: do something
  </code></pre>
  
  <p>Thank you in advance!</p>