title: Set instance variable to None inside method if condition not met
body: <p>I have a method that goes over an Excel sheet that parses out data to a set. However, if that data is not present in a sheet, I want it to return <code>None</code> rather than an empty set. Example:</p>
  <pre class="lang-py prettyprint-override"><code>import xlrd
  
  def scanSheet(self, sheet):
  
     kwds = ['kwd1','kwd2'] #pretend these are header names for the columns
     mySet = set()
  
     if not sheet:
         return self.dataset #set to None in __init__
  
      for row in range(sheet.nrows):
          for col in range(sheet.ncols):
              if str(sheet.cell_value(row, col)).lower() in kwds:
                  sheetLength = list(range(row+1, sheet.nrows)) #ignore the header row
  
                  for idx in range(len(sheetLength):
                      data = sheet.cell(sheetLength[i], col).value
                      mySet.add(data)
  
      self.dataset = mySet
  </code></pre>
  <p>If there is data, it returns a set and everything is fooly cooly. If there isn't data though, it will return, as stated above, <code>set()</code>. Is it possible to have it set to <code>None</code> if the list is empty rather than <code>set()</code>? The reason that the <code>if</code> statement at the beginning of the function wouldn't trigger a <code>None</code> value for the class variable, is a case of the Excel sheet existing, but not containing the data that is deemed interesting.</p>