Skip to content

Instantly share code, notes, and snippets.

@boyska
Created July 25, 2009 10:26
Show Gist options
  • Save boyska/154765 to your computer and use it in GitHub Desktop.
Save boyska/154765 to your computer and use it in GitHub Desktop.
create a function with a custom number of arguments (len of out_string+1)
code = 'def _f(inst'
for i in range(len(out_string)):
code += ', arg%d' % i
code += '): pass\n'
print code, 'C'
exec code in locals()
func = _f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment