Dec-09-2020, 04:43 PM
One problem with relying on named arguments is that you cannot use position arguments. You could not do this:
cap = Capacitor(ipn, mpn, dpn, manufacturer, dielectric)
Output:TypeError: Capacitor() takes 1 positional argument but 5 were given
I've noticed some functions in the Python standard libraries that have this same problem/limitation.Quote:random.choices(population, weights=None, *, cum_weights=None, k=1)I cannot call random.choices like this:
c = random.choices(values, weights, None, 10)"cum_weights" and "k" are name only arguments. This is enforced by "*" in the signature. If you want to use name-only arguments you could do the same.