Python Forum
is there a way: repeat key word args
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is there a way: repeat key word args
#1
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')
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
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
Reply
#3
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Problem: Check if a list contains a word and then continue with the next word Mangono 2 438 Aug-12-2021, 04:25 PM
Last Post: palladium
  *args implementation and clarification about tuple status amjass12 10 763 Jul-07-2021, 10:29 AM
Last Post: amjass12
  [SOLVED] Good way to handle input args? Winfried 2 541 May-18-2021, 07:33 PM
Last Post: Winfried
  Two Questions, *args and //= beginner721 8 972 Feb-01-2021, 09:11 AM
Last Post: buran
  How to discard list repeat values akanowhere 7 1,137 Dec-28-2020, 09:14 PM
Last Post: akanowhere
  I want to check if the input is str or is int & if it's str repeat the loop HLD202 4 873 Nov-23-2020, 11:01 PM
Last Post: perfringo
  Python Speech recognition, word by word AceScottie 6 11,357 Apr-12-2020, 09:50 AM
Last Post: vinayakdhage
  does yield support variable args? Skaperen 0 792 Mar-03-2020, 02:44 AM
Last Post: Skaperen
  Using function *args to multiply multiple arguments allusernametaken 8 2,401 Nov-20-2019, 12:01 AM
Last Post: allusernametaken
  print a word after specific word search evilcode1 8 2,002 Oct-22-2019, 08:08 AM
Last Post: newbieAuggie2019

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020