 <p><strong>EDIT:</strong> To make it clear, I don't recommend using this AT ALL, it will break, it's a mess, it won't help you in anyway, but it's doable for entertainment/education purposes.</p> <p>You can hack around with the <code>inspect</code> module, I don't recommend that, but you can do it... </p> <pre><code>import inspect def foo(a, f, b): frame = inspect.currentframe() frame = inspect.getouterframes(frame)[1] string = inspect.getframeinfo(frame[0]).code_context[0].strip() args = string[string.find('(') + 1:-1].split(',') names = [] for i in args: if i.find('=') != -1: names.append(i.split('=')[1].strip()) else: names.append(i) print names def main(): e = 1 c = 2 foo(e, 1000, b = c) main() </code></pre> <p>Output: </p> <pre><code>['e', '1000', 'c'] </code></pre>