title: How can repetitive variable checking be streamlined?
body: <p>I often have to execute some function, save the output, and depending on what the output was, do different things. And then later on use the output as input to more functions.</p>
  
  <p><strong>It results in a very specific pattern of code.</strong></p>
  
  <p>I feel like I'm missing something simple. 
  ... as if some logic here could be somehow streamlined. The variable declaration, variable checking, and forthcoming execution of other stuff onto said variable seems almost redundant.</p>
  
  <p>(tried to make the code as applicable to everyone and as applicable to every application, as possible)
  <strong>here's some sample code that fits this predicament:</strong></p>
  
  <pre><code>    some_sort_of_data=validate(var1, 'type1')       
      if some_sort_of_data.is_bad:
          return some_sort_of_data.is_bad
  
      more_data=validate(var2, 'type2')
      if more_data.is_bad:
          return more_data.is_bad
  
      get_special_info=get_parent_of_item(some_sort_of_data.validated_item)
      if get_special_info['error']:
          return get_special_info['data']
  
      if not (has_access_rights() or
          special_relationship(more_data.validated_item) or 
          some_sort_of_other_permissions(get_special_info['result'])):
              return "Blah Blah blah some sort of incompatibility"
  
      new_status_result=change_status(some_sort_of_data.validated_item, more_data.validated_item)
      if new_status_result['error']
          return new_status_result['result']
  
      # If we've passed all the previous checks and managed to get all the way here..
      return "yay did a thing successfully"
  </code></pre>
  
  <p>... is it just me or do you also see how such a pattern feels <em>off</em>? If so, how can it best be streamlined?</p>
  
  <p>edit: I know in some other languages you can streamline it a bit by writing</p>
  
  <pre><code>if (some_sort_of_data=validate(var1, 'type1')=="success")
      return some_sort_of_data.some_class_variable
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>some_sort_of_data=validate(var1, 'type1')       
  if some_sort_of_data=="success":
      return some_sort_of_data.some_class_variable
  </code></pre>
  
  <p>but that's still not enough and <em>still quite redundant</em>, right?</p>