I'm familiar with programming but new to python:
mem = [0] * memloadsize
what does the '[0]' represent? Is it a built-in array?
The [ and ] characters, in this context, are used to construct array literals:
>>> []
[]
>>> [0]
[0]
>>> ['a', 'b', 'c']
['a', 'b', 'c']
Multiplying arrays is idiomatic, and generates an array gotten by repeating the elements in the array by the given factor:
>>> ['a'] * 4
['a', 'a', 'a', 'a']
>>> [0] * 9
[0, 0, 0, 0, 0, 0, 0, 0, 0]
>>> [0, 1, 2] * 2
[0, 1, 2, 0, 1, 2]
Note that [ and ] are also used to index into an existing array. In that case, [0] accesses the first element in the array:
>>> a = ['first', 'second', 'third']
>>> a[0]
'first'
>>> a[2]
'third'
>>> 
                        It just means a one element list containing just a 0. Multiplying by memloadsize gives you a list of memloadsize zeros.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With