Python Instance Variable as Default Parameter
<p>I have am writing a Python function that takes a timeout value as a parameter.  Normally, the user will always use the same timeout value, but on occasion he may want to wait slightly longer.  The timeout value is stored as a class instance variable.  I want to use the class' timeout instance variable as the default parameter.  Currently, I am implementing this as follows:</p>

<pre><code>def _writeAndWait (self, string, timeout = -1):
    if (timeout == -1):
        timeout = self._timeout
</code></pre>

<p>I was just wondering, is the proper way to use an instance variable as a default parameter?  Or is there a better way that would avoid the "if" check?</p>

<p>Thanks,</p>

<p>Ryan</p>
