Python Forum
is there a way: repeat key word args - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: is there a way: repeat key word args (/thread-24148.html)



is there a way: repeat key word args - Skaperen - Feb-02-2020

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')



RE: is there a way: repeat key word args - metulburr - Feb-02-2020

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



RE: is there a way: repeat key word args - Skaperen - Feb-03-2020

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.