What is a default parameter?

I don’t understand some things in the example code:

def init(self, basin, nozzle, trash_compactor=None):

What does trash_compactor=None mean? Why is there “=None”? I’ve never seen this in an argument position before.

if trash_compactor:
if trash_compactor what? There is no condition, it seems incomplete.

Did you miss the lesson on default parameters? One would hope it was covered before this unit.


represents an optional argument in the function call. So long as at least two positional arguments are given, the __init__ method will set the third parameter to None by default.