A Common-Sense Guide to Data Structures and Algorithms, Second Edition:

Book: A Common-Sense Guide to Data Structures and Algorithms, Second Edition
Page 320
Function: collectAllWords
Python Version: CPython version 3.10.0

@jaywengrow

In the statement def collectAllWords(self, node=None, word="", words=[]), words=[] means every time we call collectAllWords we use the same list. This means the list is not empty after the first call.

code:

explanation of why:
https://web.archive.org/web/20200221224620/http://effbot.org/zone/default-values.htm

Noted, and thank you! I will clarify this issue in the next version of the book.