title: Python Warning - Expected type 'Union[Integral, slice]', got 'str' instead
body: <p>My code below in python is giving me a warning on the line: </p>
  
  <pre><code> some_new_object['someVar'] = cd['someVar']
  </code></pre>
  
  <p>The warning is</p>
  
  <pre><code>Expected type 'Union[Integral, slice]', got 'str' instead
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>def some_object():
       return {
           'someId': 0,
           'someVar' : ''
       }
  
  def warn_test(in_list):
       try:
           new_list = []
           some_new_object = some_object()
  
           for cd in in_list:
               if cd['someVar']:
                   new_list.append(cd)
  
           for cd in new_list:
               some_new_object['someVar'] = cd['someVar']
               in_list.append(some_new_object.copy())
  
           return in_list
       except Exception:
           print 'baaa'
  
   #Main Program
   new_obj =  some_object()
   new_obj['someId'] = 1
   new_obj['someVar'] = 'Next'
  
   new_obj2 =  some_object()
   new_obj2['someId'] = 1
   new_obj2['someVar'] = None
  
   new_list = []
   new_list.append(new_obj)
   new_list.append(new_obj2)
  
   out_list = warn_test(new_list)
   for obj in out_list:
       print obj
  </code></pre>
  
  <p>If I change the function warn_test to this:</p>
  
  <pre><code>def warn_test(in_list):
      try:
          new_list = []
          some_new_object = some_object()
  
          for cd in in_list:
              if cd['someVar']:
                  some_new_object['someVar'] = cd['someVar']
                  new_list.append(some_new_object.copy())
  
          for cd in new_list:
              in_list.append(cd)
  
          return in_list
      except Exception:
          print 'baaa'
  </code></pre>
  
  <p>It gives me no warning.  </p>
  
  <p>Can someone help me to understand why I get the warning, and how I can access the <code>cd['someVar']</code> in the second iteration without getting a warning?</p>
  
  <p>I know this code is weird, I need this for a project I am working on, I made this test to share here, but it gives me the same Warning so a solution for this will fix it in my system.  (No warnings is one of the Must Haves for this system)</p>