Cesare Di Mauro wrote:
2010/10/21 Benjamin Peterson email@example.com
Georg Brandl <g.brandl@...> writes:
You must be talking of a different restriction.
I assumed Raymond was talking about calling a function with > 255 args.
I think that having max 255 args and 255 kwargs is a good and reasonable limit which we can live on, and helps the virtual machine implementation (and implementors :P).
Python won't lose its "power" and "generality" if one VM (albeit the "mainstream" / "official" one) have some limits.
We already have some other ones, such as max 65536 constants, names, globals and locals. Another one is the maximum 20 blocks for code object. Who thinks that such limits must be removed?
I think that having more than 255 arguments for a function call is a very rare case for which a workaround (may be passing a tuple/list or a dictionary) can be a better solution than having to introduce a brand new opcode to handle it.
It's certainly rare when writing applications by hand, but such limits can be reached with code generators wrapping external resources such as database query rows, spreadsheet rows, sensor data input, etc.
We've had such a limit before (number of lines in a module) and that was raised for the same reason.
Changing the current opcode(s) is a very bad idea, since common cases will slow down.
I'm sure there are ways to avoid that, e.g. by using EXTENDED_ARG for such cases.