On 21.04.2016 20:28, Serhiy Storchaka wrote:
On 21.04.16 19:00, Chris Angelico wrote:
On Fri, Apr 22, 2016 at 1:52 AM, Serhiy Storchaka email@example.com wrote:
- Since the number of keyword arguments is obtained from tuple's
size, new CALL_FUNCTION opcode needs only the number of positional arguments. It's argument is simpler and needs less bits (important for wordcode).
What about calls that don't include any keyword arguments? Currently, no pushing is done. Will you have two opcodes, one if there are kwargs and one if there are not?
Yes, we need either two opcodes, or a falg in the argument. I prefer the first approach to keep the argument short and simple.
Also: How does this interact with **dict calls?
For now we have separate opcode for calls with **kwargs. We will have corresponding opcode with new way to provide keyword arguments.
Instead of 4 current opcodes we will need at most 8 new opcodes. May be less, because calls with *args or **kwargs is less performance critical, we can pack arguments in a tuple and a dict by separate opcodes and call a function just with a tuple and a dict.
We can limit second argument (number of kw args) to be 0 or 1 only. With 1 meaning single tuple with the names.