Guest User

Untitled

a guest
Jun 24th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. items = [1,2,3,4,5,6]
  2.  
  3. def do_something(*items):
  4. pass
  5.  
  6. >>> fstr = 'def f(%s): pass'%(', '.join(['arg%d'%i for i in range(5000)]))
  7. >>> exec(fstr)
  8. >>> f
  9. <function f at 0x829bae4>
  10.  
  11. >>> exec 'f(' + ','.join(str(i) for i in range(5000)) + ')'
  12.  
  13. Traceback (most recent call last):
  14. File "<pyshell#63>", line 1, in <module>
  15. exec 'f(' + ','.join(str(i) for i in range(5000)) + ')'
  16. File "<string>", line 1
  17. SyntaxError: more than 255 arguments (<string>, line 1)
  18.  
  19. >>> f(*range(5000))
  20. >>>
  21.  
  22. if (nargs + nkeywords + ngens > 255) {
  23. ast_error(n, "more than 255 arguments");
  24. return NULL;
  25. }
Add Comment
Please, Sign In to add comment