What are the conventions for ordering parameters in Python?

Viewed 1381

What are the conventions for ordering parameters in Python? For instance,

def plot_graph(G, filename, ...)

# OR

def plot_graph(filename, G, ...)

There is no discussion in PEP 0008 -- Style Guide for Python Code | Python.org

Excerpt from the answer of Conventions for order of parameters in a function,

If a language allows passing a hash/map/associative array as a single parameter, try to opt for passing that. This is especially useful for methods with >=3 parameters, ESPECIALLY when those same parameters will be passed to nested function calls.

Is it extreme to convert each parameter into a key-value pair, like def plot_graph(graph=None, filename=None, ...)?

2 Answers
Related