title: Using instance variable in Python class function definition
body: <p>How can I set the default value in the class definition to one of the class' instance variable?</p>
  
  <pre><code>class SomeClass:
      def __init__(self, data):
          self.data = data
  
      def do_something(self, data_file=self.data):  # Here
  
          # modify the data and return to itself using recursion.
          if something:
              return self.do_something(data_file)
          else:
              return data_file
  </code></pre>