title: Python - TypeError: argument of type 'function' is not iterable
body: <p>I'm running some python code and get an error:</p>
  
  <pre><code>Exception in Tkinter callback
  Traceback (most recent call last):
    File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
      return self.func(*args)
    File "multiline14.py", line 28, in getText
      if encodinghex in process:
  TypeError: argument of type 'function' is not iterable
  </code></pre>
  
  <p>My def is below.</p>
  
  <pre><code>def gui(item):
      def default_encode(s):
          pass
  
      # map items from menu to commands
      encodinghex = '.encode("hex")'
      decodinghex = '.decode("hex")'
      mapping = {"encode_b64": base64.encodestring,"encode_url": urllib.quote_plus,"encode_hex": encodinghex, "decode_b64": base64.decodestring, "decode_url": urllib.unquote_plus, "decode_hex": decodinghex}
  
  
      process = mapping.get(item, default_encode)
  
      def getText():
      #clear bottom text field
          bottomtext.delete(1.0, END)
      #var equals whats in middle
          var = middletext.get(1.0, 'end-1c')
  
      #insert encoded var in bottom
          if encodinghex in process:
              var = '"%s"' % (var)
              bottomtext.insert(INSERT, eval(var + process))
          elif decodinghex in process:
              var = '"%s"' % (var)
              bottomtext.insert(INSERT, eval(var + process))
          else:
              bottomtext.insert(INSERT, process(var))
  </code></pre>
  
  <p>What causes that error?</p>