python (12.9k questions)
javascript (9.2k questions)
reactjs (4.7k questions)
java (4.2k questions)
java (4.2k questions)
c# (3.5k questions)
c# (3.5k questions)
html (3.3k questions)
Clean up long list of keyword args in Python?
If I have a function
def func(a=1, b=2, c=3, d=4, e=5, f=6, g=7):
return a * b * c * d * e * f * g
and I want extend this to have the entire alphabet as keyword arguments, is there a way to do th...
Chad
Votes: 0
Answers: 2
Pass dictionaries in function as arguments
Im trying to create a function that take unknown number of arguments (dictionaries) to merge them in one. Here is my sketch:
weight = {"sara": 60, "nick": 79, "sem": 78, ...
Pobaranchuk
Votes: 0
Answers: 3
Passing multiple strings to a function and appending to list
class Dog:
tricks = []
def __init__(self,name):
self.name=name
def add_tricks(self, trick ):
self.tricks.extend(trick)
I keep getting the error that add_tricks only accepts 1 posit...
dv24680
Votes: 0
Answers: 1
How to detect invalid kwargs?
I'm trying to develop a mechanism to detect invalid kwargs that is robust to inheritance. I want to create a class with an init method that checks for unexpected kwargs, and I want to create another ...
Chad
Votes: 0
Answers: 2