Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- items = [1,2,3,4,5,6]
- def do_something(*items):
- pass
- >>> fstr = 'def f(%s): pass'%(', '.join(['arg%d'%i for i in range(5000)]))
- >>> exec(fstr)
- >>> f
- <function f at 0x829bae4>
- >>> exec 'f(' + ','.join(str(i) for i in range(5000)) + ')'
- Traceback (most recent call last):
- File "<pyshell#63>", line 1, in <module>
- exec 'f(' + ','.join(str(i) for i in range(5000)) + ')'
- File "<string>", line 1
- SyntaxError: more than 255 arguments (<string>, line 1)
- >>> f(*range(5000))
- >>>
- if (nargs + nkeywords + ngens > 255) {
- ast_error(n, "more than 255 arguments");
- return NULL;
- }
Add Comment
Please, Sign In to add comment