Image

Imageutil wrote in Imagepython_dev

Efficient way to initialize array?

Is the following an efficient way to create a list of size n, each element initialized with value?

data = n * [value]

What's the idiomatic way of accomplishing this?

Is the following an efficient way to create an array with the same requirements?

import array
data = n * array.array('B', [value])


Thank you.