The question is asked in the context of Python, but it is also relevant for any languages with named parameters support.
If some entity in my code (e.g. a pubsub implementation) or even a simple function accepts a callback, does it make more sense to call it with positional arguments or with named arguments?
def foo(on_foo_ended): foo_result = await ... # Call with positional argument: on_foo_ended(foo_result) # Call with named argument: on_foo_ended(result=foo_result)
A call with positional arguments does not require any arbitrary parameter naming from the user, but may instead impose arbitrary parameter ordering. Named arguments require matching parameter names, but are (to some extent) self-documenting and do not force the user to order them.
Assuming we are developing a library, it would be preferable to use the most common convention if there is one. If there is none, would it make sense to prefer one way over the other? I suppose complex strategies like "pass positional argument when there is only one and named arguments when there are two or more" would be too arbitrary and probably difficult to use.