Python Forum
i want to use type= as a function/method keyword argument
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i want to use type= as a function/method keyword argument
#1
i want to use type= as a function/method keyword argument:
result = that_function(buffer1,buffer2,limit=4096,type=bytes)
can i successfully use type= as a keyword argument when it is defined like:
def that_function(buf1,buf2,**kwargs):
    ty = kwargs.pop("type",None)
    ...
    do_stuff(ty,buf1)
    do_stuff(ty,buf2)
    ...
    return buf1+buf2
?
Tradition is peer pressure from dead people

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


Messages In This Thread
i want to use type= as a function/method keyword argument - by Skaperen - Oct-31-2022, 12:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Django "Unexpected Keyword Argument 'min_value'" AstralWeeks 0 240 Mar-27-2024, 04:56 AM
Last Post: AstralWeeks
  mutable argument in function definition akbarza 1 492 Dec-15-2023, 02:00 PM
Last Post: deanhystad
  Find a specific keyword after another keyword and change the output sgtmcc 5 855 Oct-05-2023, 07:41 PM
Last Post: deanhystad
  determine parameter type in definition function akbarza 1 595 Aug-24-2023, 01:46 PM
Last Post: deanhystad
Information How to take url in telegram bot user input and put it as an argument in a function? askfriends 0 1,107 Dec-25-2022, 03:00 PM
Last Post: askfriends
  match type with value in csv parsing function vinci 2 1,324 Jan-21-2022, 12:19 PM
Last Post: Larz60+
Question How to pass a method as argument in an another method? anilanvesh 6 2,764 Sep-30-2021, 10:18 PM
Last Post: deanhystad
  Regex - Pass Flags as a function argument? muzikman 6 3,619 Sep-06-2021, 03:43 PM
Last Post: muzikman
  TypeError: __init__() got an unexpected keyword argument 'value' Anldra12 7 22,699 May-11-2021, 06:35 PM
Last Post: deanhystad
  How to use a tuple as an argument of a function zarox 5 3,650 Nov-14-2020, 08:02 PM
Last Post: buran

Forum Jump:

User Panel Messages

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