Viewing a single comment thread. View all comments

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!

2

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

2