code: def call_only_once(func):
      '''
      To be used as a decorator
  
      @call_only_once
      def func():
          print 'Calling func only this time'
  
      Actually, in PyDev it must be called as:
  
      func = call_only_once(func) to support older versions of Python.
      '''
  
      def new_func(*args, **kwargs):
          if not new_func._called:
              new_func._called = True
              return func(*args, **kwargs)
  
      new_func._called = False
      return new_funf call_only_once(func):
      '''
      To be used as a decorator
  
      @call_only_once
      def func():
          print 'Calling func only this time'
  
      Actually, in PyDev it must be called as:
  
      func = call_only_once(func) to support older versions of Python.
      '''
  
      def new_func(*args, **kwargs):
          if not new_func._called:
              new_func._called = True
              return func(*args, **kwargs)
  
      new_func._called = False
      return new_func
docs: To be used as a decorator
  
      @call_only_once
      def func():
          print 'Calling func only this time'
  
      Actually, in PyDev it must be called as:
  
      func = call_only_once(func) to support older versions of Python.