skulpt/skulpt — pull request #273 by daviesian (2014-08-05 18:21:47+00:00)
Title: Support keyword arguments in methods

In current master, Python methods don't support keyword arguments. The following Python will fail on skulpt:master. This PR fixes that.

{{{python
class MyClass:
def my_method(self, mandatory_arg, x=0, y=0, **more_args):
print "Hello! x = " + str(x)

def my_method2(self):
self.my_method("hi", y=2)
}}}

However, it looks like Sk.builtin.method.prototype.tp$call has a lot in common with Sk.builtin.func.prototype.tp$call (there is evidence of copy-and-paste, after which presumably the func version was updated with keyword arguments and the method one wasn't), so perhaps they should be merged.

The only major difference I can see that would prevent this is the closure stuff - is there some way of working around that and merging these two functions, or should they be kept separate?