python (65.2k questions)
javascript (44.3k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (13k questions)
function to decide which classification method to use with optional parameters - Python
My goal is to include a "mod_type" param that indicates the type of model to run, either a decision tree or knn, using kwargs to let the user pass in the optional keyword params "k"...
MelaniaCB
Votes: 0
Answers: 2
How to pass **kwargs as params to FastAPI endpoint?
I have a function generating a dict template. This function consists of several generators and requires one parameter (i.e., carrier) and has many optional parameters (keyword arguments - **kwargs).
d...
PetrSevcik
Votes: 0
Answers: 1
Python: Recursive function with keyword arguments with default values
I have a recursive function in my python script which looks something like this:
def recurse(nodes, keep_x=False, keep_y=False):
for node in nodes:
if not keep_x:
node.pop('x', None)...
Robin
Votes: 0
Answers: 1
Pass kwargs to function argument explictly
Is there a way in Python to pass explicitly a dictionary to the **kwargs argument of a function? The signature that I'm using is:
def f(*, a=1, **kwargs): pass # same question with def f(a=1, **kwargs...
Codoscope
Votes: 0
Answers: 3