Python Forum

Full Version: variable args + named options
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
def foo(*varargs,bar=256):
    ...
    ...
    return bar
this is OK in Python3 but not in Python2. apparently, Python2 requires something else, like:

def foo(*varargs,**options):
    ...
    bar=256
    if 'bar' in options:
        bar=options['bar']
    ...
    return bar
how did i miss that?