naked asterisk as parameter in method definition: def f(*)

def f(*) has the same effect as def f(*args), except that it does not name the globbed argument array. You might use it if you want the function to accept any number of arguments but don’t actually need to refer to them within the function — for example, if you are overriding a method but calling super without passing an explicit argument list, which results in the original arguments being passed to super.

You can write def f(a, b, *) as well.

Leave a Comment