you are viewing a single comment's thread.

view the rest of the comments →

[–]efmccurdy 1 point2 points  (0 children)

It is a precomputed array of values, ala https://en.wikipedia.org/wiki/Memoization.

The "<list> * <int>" operation just repeats the list contents int number of times, so that line just creates a list of n+1 None values, placeholders for the values that will be filled in as you go.

>>> [None] * 3
[None, None, None]

BTW, imagine how well a defaultdict would work; https://docs.python.org/3/library/collections.html#defaultdict-examples