I thought I could use named parameters after variable-length positional parameters in a function call in Python 2, but I get a SyntaxError
when importing a python class. I'm writing with the following "get" method, for example:
class Foo(object):
def __init__(self):
print "You have created a Foo."
def get(self, *args, raw=False, vars=None):
print len(args)
print raw
print vars
The error looks like:
def get(self, *args, raw=False, vars=None):
^
SyntaxError: invalid syntax
I'd like to be able to call the method several ways:
f = Foo()
f.get(arg1, arg2)
f.get(arg1, raw=True)
f.get(arg1, arg2, raw=True, vars=something)
etc.