title: How do I define a function with optional arguments?
body: <p>I have a Python function which takes several arguments. Some of these arguments could be omitted in some scenarios.</p>
  
  <pre><code>def some_function (self, a, b, c, d = None, e = None, f = None, g = None, h = None):
      #code
  </code></pre>
  
  <p>The arguments <code>d</code> through <code>h</code> are strings which each have different meanings. It is important that I can choose which optional parameters to pass in any combination. For example, <code>(a, b, C, d, e)</code>, or <code>(a, b, C, g, h)</code>, or <code>(a, b, C, d, e, f</code>, or all of them (these are my choices). </p>
  
  <p>It would be great if I could overload the function - but I read that Python does not support overloading. I tried to insert some of the required int arguments in the list - and got an argument mismatch error.</p>
  
  <p>Right now I am sending empty strings in place of the first few missing arguments as placeholders. I would like to be able to call a function just using actual values.</p>
  
  <p>Is there any way to do this? Could I pass a list instead of the argument list?</p>
  
  <p>Right now the prototype using ctypes looks something like:</p>
  
  <pre><code>_fdll.some_function.argtypes = [c_void_p, c_char_p, c_int, c_char_p, c_char_p, c_char_p, c_char_p, c_char_p]
  </code></pre>