Submitted by twovests in programming
flabberghaster wrote
I think my favorite feature along these lines is splatting.
def draw_circle(x, y, r, line_color="#ff0000", fill_color="#00ff00"):
...
args = [10, 20, 2]
kwargs = {"line_color": "#0000ff", "fill_color": "#ff0000"}
draw_circle(*args, **kwargs)
it works the other way too. It's such a useful feature!
twovests OP wrote
omg! i never knew you could do that! I knew about *args and **kwargs for variable-argument functions but I never saw this usage
Viewing a single comment thread. View all comments