TechToFreedom
Published in

TechToFreedom

Mind the Default Arguments in Python Functions

This is one of the biggest sources of bugs

Mind the Default Arguments in Python Functions
Photo by Boris Smokrovic on Unsplash

Assigning a default value to a keyword argument is very common when defining a Python function. Because it can avoid potential bugs, this practice is strongly recommended if we cannot make sure whether the keyword argument will always receive a value or not.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store