Sahaj.blogs

Day page

13 Sept 2023

Study

Python · Functions: arguments and return values

Defining functions, positional vs keyword arguments, default values, the mutable-default trap, and returning several values.

  • Default values are evaluated once, when the function is defined, so never use a mutable default like [].
  • Returning a, b actually returns one tuple, which the caller can unpack.

Read the post →