Pass boolean values as input to method
<p>How do I pass boolean as argument to a method ?</p>

<p>For example, I have a code as below:</p>

<pre><code>def msg_util(self, auth_type=None,starttls=False):
....
starttls=True
invoke_tls(self, auth_type, auth_value, "require_tls=%s" %starttls)
....
....
def invoke_tls(self, auth_type=None, auth_value=None,range=None,style=None, adminuser=None,require_tls=False):
...
</code></pre>

<p>Since am passing <code>starttls</code> as string from <code>invoke_tls</code> method, in the method definition <code>invoke_tls</code>, if <code>require_tls</code> is not set to boolean False by default, <code>starttls</code> is taken as "True" (string)</p>

<p>Please let me know if there is a way I can pass boolean type as optional parameters in python.</p>

<p>I know that one way is to process the string in if else condition and process it as below:</p>

<pre><code>def t_or_f(arg):
    ua = str(arg).upper()
    if 'TRUE'.startswith(ua):
       return True
    elif 'FALSE'.startswith(ua):
       return False
</code></pre>

<p>But, please let me know if there is any other effective or better way to pass boolean values as input to another method ?</p>