title: Using None as parameter to keyword argument
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12265695/python-returning-a-default-value">python - returning a default value</a>  </p>
  </blockquote>
  
  
  
  <p>I have a function in a class:</p>
  
  <pre><code>def foo(self, value = None):
      if value is None:
          return self.value
      self.value = value
      return self
  </code></pre>
  
  <p>This is a getter and setter combined into one, with the advantage that I can chain functions like this:</p>
  
  <pre><code>three = anInstanceOfMyClass.foo(3).bar().foo()
  </code></pre>
  
  <p>The problem appears when I do like this:</p>
  
  <pre><code>shouldBeNoneButIsThree = anInstanceOfMyClass.foo(3).foo(None).foo()
  </code></pre>
  
  <p>Here foo thinks that I did not pass an argument.
  I can avoid this by:</p>
  
  <ol>
  <li>Setting value to some strange object, like a random string</li>
  <li>Create an object instance in the constructor which value has as default value</li>
  </ol>
  
  <p>Both seem a bit too much work, what is an easier way?</p>
  
  <p>setting value to something</p>