title: What happens when a function returns its own name in python?
body: <pre><code>def traceit(frame, event, trace_arg):
      global stepping
  
      if event == 'line':
          if stepping or frame.f_lineno in breakpoints:
              resume = False
              while not resume:
                  print(event, frame.f_lineno, frame.f_code.co_name, frame.f_locals)
                  command = input_command()
                  resume = debug(command, frame.f_locals)
      return traceit
  </code></pre>
  
  <p>What is the meaning of the last line in the code?</p>
  
  <p>EDIT:</p>
  
  <pre><code>def remove_html_markup(s):
      tag   = False
      quote = False
      out   = ""
  
      for c in s:
          if c == '&lt;' and not quote:
              tag = True
          elif c == '&gt;' and not quote:
              tag = False
          elif c == '"' or c == "'" and tag:
              quote = not quote
          elif not tag:
              out = out + c
      return out
  
  def main():
      print (remove_html_markup('xyz'))
      print (remove_html_markup('"&lt;b&gt;foo&lt;/b&gt;"'))
      print (remove_html_markup("'&lt;b&gt;foo&lt;/b&gt;'"))
  
  # globals
  breakpoints = {9: True}
  stepping = False
  
  def debug(command, my_locals):
      global stepping
      global breakpoints
  
      if command.find(' ') &gt; 0:
          arg = command.split(' ')[1]
      else:
          arg = None
  
      if command.startswith('s'):     # step
          stepping = True
          return True
      elif command.startswith('c'):   # continue
          stepping = False
          return True
      elif command.startswith('q'):   # quit
          sys.exit(0)
      else:
          print ("No such command", repr(command))
  
      return False
  
  commands = ['s', 's', 's', 'q']
  
  def input_command():
      #command = raw_input("(my-spyder) ")
      global commands
      command = commands.pop(0)
      return command
  
  def traceit(frame, event, trace_arg):
      global stepping
  
      if event == 'line':
          if stepping or frame.f_lineno in breakpoints:
              resume = False
              while not resume:
                  print(event, frame.f_lineno, frame.f_code.co_name, frame.f_locals)
                  command = input_command()
                  resume = debug(command, frame.f_locals)
      return traceit
  
  # Using the tracer
  sys.settrace(traceit)
  main()
  sys.settrace(None)
  </code></pre>