title: variable set to function call returns None
body: <p>I am making a simple ceaser cipher program in python, and this concept has confused me for quite some time.</p>
  
  <p>What I do is ask for raw_input from users to determine the message and key for the cipher like so:</p>
  
  <pre><code>def user_input():
      ask_user = raw_input("Do you want to encrypt or decrypt a     message?")
      if ask_user in "encrypt e".split():
          message = get_message()
          key = get_key()
          translate_message(message, key)
      else:
          print 'Type encrypt or e for encryption, or decrypt or d doe decryption'
          user_input()
  </code></pre>
  
  <p>This collects the message and key, and passes into translate_message for the actual encryption.</p>
  
  <p>Here is my get_message function:</p>
  
  <pre><code>def get_message():
      get_user_message = raw_input('enter in your message\n')
      vm = validate_message(get_user_message)
      if not vm:
          print 'Please enter a valid message'
          get_message()
      else:
          print get_user_message
          return get_user_message
  </code></pre>
  
  <p>I want to validate the input to make sure the user enters the correct values. If the value is incorrect according to validate_message,it calls get_message again, else get_message returns the original value.</p>
  
  <p>Here's validate_message:</p>
  
  <pre><code>def validate_message(message):
      if not re.match(r'^[A-Za-z]+$', message):
          return False
      return True
  </code></pre>
  
  <p>Just a simple check (I like my functions to do one thing)</p>
  
  <p>Normally, this runs fine and the key &amp; message values are returned like normal. The problem comes when I intentionally input incorrect values to test my validation.</p>
  
  <p>Here's what translate_message returns without incorrect values(it just returns the two values):</p>
  
  <pre><code>'test_message', 22
  </code></pre>
  
  <p>The confusion comes when I input incorrect values. Say I enter 3333 (will recall get_message() because of incorrect value), until the user enters correct input. translate_message returns None if the user enters any kind of incorrect value before successfully entering a value</p>
  
  <pre><code>None, 22
  </code></pre>
  
  <p>In the get_message() function I add a print statement right before the return value, which prints out the correct value as expected. So why is</p>
  
  <p>key = get_key()</p>
  
  <p>equaling to None? I went through the logic in get_message() and I can't see where the return value is equal to None when it should return the users correct guess.</p>
  
  <p>Any help is appreciated, and if there is a better way to implement this type of logic, I'd like to know! I'm fairly new to python programming.</p>
  
  <p>Thanks!</p>