<p>I would like to know if it is possible to determine if a function parameter with a default value was passed in Python.
For example, how does dict.pop work?</p>

<pre><code>&gt;&gt;&gt; {}.pop('test')
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
KeyError: 'pop(): dictionary is empty'
&gt;&gt;&gt; {}.pop('test',None)
&gt;&gt;&gt; {}.pop('test',3)
3
&gt;&gt;&gt; {}.pop('test',NotImplemented)
NotImplemented
</code></pre>

<p>How does the pop method determine that the first time a default return value was not passed? Is this something that can only be done in C?</p>

<p>Thanks</p>

You can do it like this:
```
```
def isdefarg(*args):
    if len(args) > 0:
        print len(args), "arguments"
    else:
        print "no arguments"

isdefarg()
isdefarg(None)
isdefarg(5, 7)
```
```
See the Python documentation on
calls
for full information.