title: Best way to do a "not None" test in Python for a normal and Unicode empty string?
body: <p>In Python 2.7, I'm writing a class that calls a function in an API which might, or might not, return an empty string. Furthermore, the empty string might be unicode <code>u""</code>, or non-unicode <code>""</code>. I was wondering what the best way to check for this?</p>
  
  <p>The following code works great for an empty string, but not an empty unicode string:</p>
  
  <pre><code>class FooClass():
      string = ...
      string = might_return_normal_empty_string_or_unicode_empty_string(string)
  
      # Works for normal empty strings, not unicode:
      if string is not None:
          print "string is not an empty string."
  </code></pre>
  
  <p>Instead I'd have to write it like this to get it to work for unicode:</p>
  
  <pre><code>class BarClass():
      string = ...
      string = might_return_normal_empty_string_or_unicode_empty_string(string)
  
      # Works for unicode empty strings, not normal:
      if string is not u"":
          print "string is not an empty string."
  </code></pre>
  
  <p>...and like this to get it to work for both empty strings in non-unicode and unicode:</p>
  
  <pre><code>class FooBarClass():
      string = ...
      string = might_return_normal_empty_string_or_unicode_empty_string(string)
  
      # Works for both normal and unicode empty strings:
      if string is not u"" or None:
          print "string is not an empty string."
  </code></pre>
  
  <p>Is the third method the best way to do this, or is there a better way? I ask because writing a <code>u""</code> feels a little too hard-coded to me. But if that's the best way to do it, so be it. :) Thanks for any help you can offer.</p>