|
|
|
|
|
by winterlight
3203 days ago
|
|
Nope, that works just fine. >>> def f(*x): print(x[-1])
>>> f(range(300))
299
And surprisingly, in python 2.7, I was able to define a function that takes more than 255 arguments. But perhaps this only worked because I cheated and used exec. >>> exec("def f(" + ",".join("f" + str(x) for x in range(300)) + "): print(f299)"
>>> f(*range(300))
299
|
|
It looks like they either had changed the internals of python 3, making it fail at the definition as a side effect instead of when calling, or used the same underlying logic but purposely chose to issue the exception to potentially catch the problem earlier...