Python Forum

Full Version: is there a way: repeat key word args
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i would like to allow the same key word argument to be repeated as many times as desired with different values, just as i can do on command arguments. if this is not possible the i will have to just live with accepting a list or set (or tuple or frozenset).
    x = explore(1,place='usa',place='eu')
To me that doesnt make sense as the function would not know which to assign place variable as.

Im assuming you know you can pass a list via
args = ['usa','eu']
def explore(*args):
    pass
i did mention that i would have to accept a list. i was hoping for such an object. i did create such a thing in C. and it even retained insert order.