Where can I find documentation on the code below? Why does multiplying an array by 2, inserts another False into the array?
print( [False] * 2 )
output: [False, False]
It doubled the list. Basically multiplying the number of references inside the list. That is the expected behavior.
print(['a', 'b', 'c'] * 3)
['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']
Python has a number of operator methods - the multiplication method is called __mul__ (https://docs.python.org/3.7/library/operator.html#operator.mul) Any class/module can define its own __mul__ method, which will be run when it is multiplied (which is what happens when you use *)
If you look at a list you can see it has __mul__ defined:
["a", "b"].__mul__
<method-wrapper '__mul__' of list object at 0x7efc163fe9d0>
You can call this method with a number:
["a", "b"].__mul__(2)
["a", "b", "a", "b"]
list