A pro tip for using functions in Python

Use the names of function parameters when calling functions. This improves readability and enables functions to work even if the order of the parameters is different:

def fun(a, b, c):
  pass
  
fun(a=1, b=7, c=13)

The following calls would work in the exact same way:

fun(a=1, c=13, b=7)
fun(b=7, a=1, c=13)
fun(b=7, c=13, a=1)
fun(c=13, a=1, b=7)
fun(c=13, b=7, a=1)
Written on September 23, 2020